ztk 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -171,13 +171,13 @@ module ZTK::DSL
171
171
  # puts("extended(#{base})")
172
172
  end
173
173
 
174
- def initialize(&block)
175
- self.id = self.class.id
174
+ def initialize(id=nil, &block)
175
+ self.id = (id || self.class.id)
176
176
  self.class.dataset << self
177
177
  block_given? and ((block.arity < 1) ? instance_eval(&block) : block.call(self))
178
178
 
179
179
  primary_key_count = self.class.dataset.count do |d|
180
- # puts("d.id == #{d.id.inspect} / self.id == #{self.id.inspect}")
180
+ # puts("d.id == #{d.id.inspect} / self.id == #{self.id.inspect}")
181
181
  d.id == self.id
182
182
  end
183
183
  # puts("primary_key_count == #{primary_key_count}")
@@ -91,10 +91,10 @@ module ZTK::DSL::Core::Relations
91
91
  set_has_many_reference(key, value)
92
92
  end
93
93
 
94
- define_method(key.to_s.singularize) do |&block|
94
+ define_method(key.to_s.singularize) do |id=nil, &block|
95
95
  options = self.class.has_many_relations[key]
96
96
  logger.debug { "#{key.to_s.singularize} block(#{block.inspect}), options(#{options.inspect})" }
97
- data = options[:class_name].constantize.new(&block)
97
+ data = options[:class_name].constantize.new(id, &block)
98
98
  get_has_many_reference(key) << data
99
99
  klass = self.class.to_s.demodulize.singularize.downcase
100
100
  logger.debug { "send(#{klass})" }
@@ -21,6 +21,6 @@
21
21
  module ZTK
22
22
 
23
23
  # ZTK Version String
24
- VERSION = "1.0.3"
24
+ VERSION = "1.0.4"
25
25
 
26
26
  end
@@ -176,7 +176,7 @@ describe ZTK::SSH do
176
176
 
177
177
  describe "upload" do
178
178
 
179
- it "should be able to upload a file to 127.0.0.1 as the current user and execute a command (your key must be in ssh-agent)" do
179
+ it "should be able to upload a file to 127.0.0.1 as the current user (your key must be in ssh-agent)" do
180
180
  subject.config do |config|
181
181
  config.ui = $ui
182
182
 
@@ -204,7 +204,7 @@ describe ZTK::SSH do
204
204
 
205
205
  describe "download" do
206
206
 
207
- it "should be able to download a file from 127.0.0.1 as the current user and execute a command (your key must be in ssh-agent)" do
207
+ it "should be able to download a file from 127.0.0.1 as the current user (your key must be in ssh-agent)" do
208
208
  subject.config do |config|
209
209
  config.ui = $ui
210
210
 
@@ -393,7 +393,7 @@ describe ZTK::SSH do
393
393
 
394
394
  describe "upload" do
395
395
 
396
- it "should be able to upload a file to 127.0.0.1 as the current user and execute a command (your key must be in ssh-agent)" do
396
+ it "should be able to upload a file to 127.0.0.1 as the current user (your key must be in ssh-agent)" do
397
397
  subject.config do |config|
398
398
  config.ui = $ui
399
399
 
@@ -423,7 +423,7 @@ describe ZTK::SSH do
423
423
 
424
424
  describe "download" do
425
425
 
426
- it "should be able to download a file from 127.0.0.1 as the current user and execute a command (your key must be in ssh-agent)" do
426
+ it "should be able to download a file from 127.0.0.1 as the current user (your key must be in ssh-agent)" do
427
427
  subject.config do |config|
428
428
  config.ui = $ui
429
429
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ztk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-11 00:00:00.000000000 Z
12
+ date: 2013-02-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: erubis
@@ -250,7 +250,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
250
250
  version: '0'
251
251
  segments:
252
252
  - 0
253
- hash: 3659297578291030360
253
+ hash: 1589167038471120056
254
254
  required_rubygems_version: !ruby/object:Gem::Requirement
255
255
  none: false
256
256
  requirements:
@@ -259,7 +259,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
259
259
  version: '0'
260
260
  segments:
261
261
  - 0
262
- hash: 3659297578291030360
262
+ hash: 1589167038471120056
263
263
  requirements: []
264
264
  rubyforge_project:
265
265
  rubygems_version: 1.8.24