gather 0.0.7 → 0.0.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ == 0.0.8
2
+ * Fix the property accessors. They were returning values inside arrays under
3
+ some conditions. Write tests to check this.
4
+
1
5
  == 0.0.7
2
6
  * Remove Hoe dependency
3
7
  * check arity differently with ruby-1.9.2
data/Rakefile CHANGED
@@ -12,4 +12,5 @@ Bones {
12
12
  authors 'John Anderson'
13
13
  email 'panic@semiosix.com'
14
14
  url 'https://rubygems.org/gems/gather'
15
+ description 'A gem that provides modules to make working with properties a bit easier.'
15
16
  }
@@ -163,7 +163,8 @@ module Changes
163
163
  if val.empty?
164
164
  @#{property}
165
165
  else
166
- self.#{property} = *val
166
+ unwrapped_value = val.size == 1 ? val[0] : val
167
+ self.#{property} = unwrapped_value
167
168
  end
168
169
  end
169
170
 
@@ -179,7 +180,7 @@ module Changes
179
180
  @before_#{property}_block = block
180
181
  end
181
182
 
182
- def #{property}=(*new_value)
183
+ def #{property}=(*new_value)
183
184
  unwrapped_value = new_value.size == 1 ? new_value[0] : new_value
184
185
  return if unwrapped_value == @#{property}
185
186
 
@@ -122,24 +122,24 @@ module Gather
122
122
  def property( *symbols )
123
123
  @stripper_re ||= /^([^\= ]+)\s*\=?\s*$/
124
124
  symbols.each do |sym|
125
- stripped = @stripper_re.match( sym.to_s )[1]
126
- own_properties << stripped.to_sym
125
+ method_name = @stripper_re.match( sym.to_s )[1]
126
+ own_properties << method_name.to_sym
127
127
  line, st = __LINE__, <<-EOF
128
- def #{stripped}(*val, &block)
128
+ def #{method_name}(*val, &block)
129
129
  if block.nil?
130
130
  if val.empty?
131
- @#{stripped}
131
+ @#{method_name}
132
132
  else
133
133
  # use the assignment, so only it has to be overloaded
134
- self.#{stripped} = val.size == 1 ? val[0] : val
134
+ self.#{method_name} = val.size == 1 ? val[0] : val
135
135
  end
136
136
  else
137
- @#{stripped} = block
137
+ @#{method_name} = block
138
138
  end
139
139
  end
140
140
 
141
- def #{stripped}=( value )
142
- @#{stripped} = value
141
+ def #{method_name}=( value )
142
+ @#{method_name} = value
143
143
  end
144
144
  EOF
145
145
  class_eval st, __FILE__, line + 1
@@ -1,18 +1,30 @@
1
1
  require File.dirname(__FILE__) + '/test_helper.rb'
2
+ require 'changes'
2
3
 
3
- class TestChanges < Test::Unit::TestCase
4
- def self.startup
5
- end
4
+ class SumDumClass
5
+ include Changes
6
6
 
7
- def self.shutdown
8
- end
9
-
10
- def setup
11
- end
12
-
13
- should "be true" do
14
- assert true
7
+ property :aac
8
+ property :ben
9
+ property :civ
10
+ end
11
+
12
+ class TestChanges < Test::Unit::TestCase
13
+ context "instantiated with hash" do
14
+ setup do
15
+ @instance = SumDumClass.new(
16
+ :aac => 'hey',
17
+ :ben => 'thewre',
18
+ :civ => 'dude'
19
+ )
20
+ end
21
+
22
+ should 'have correct values' do
23
+ assert_equal 'hey', @instance.aac
24
+ assert_equal 'thewre', @instance.ben
25
+ assert_equal 'dude', @instance.civ
26
+ end
15
27
  end
16
28
 
17
- should_eventually "do some real tests"
29
+ should_eventually "do more tests"
18
30
  end
@@ -103,6 +103,12 @@ class TestGather < Test::Unit::TestCase
103
103
  assert_equal arr, @instance.to_a
104
104
  assert_equal arr, @instance.values
105
105
  end
106
+
107
+ should 'be correct' do
108
+ assert_equal 'hey', @instance.aac
109
+ assert_equal 'thewre', @instance.ben
110
+ assert_equal 'dude', @instance.civ
111
+ end
106
112
  end
107
113
 
108
114
  should_eventually "test merge with a hash"
@@ -1,3 +1,7 @@
1
+ if defined?( RUBY_VERSION ) && RUBY_VERSION < "1.9.0"
2
+ require 'rubygems'
3
+ end
4
+
1
5
  require 'test/unit'
2
6
  require 'shoulda'
3
7
  require 'pathname'
@@ -1 +1 @@
1
- 0.0.7
1
+ 0.0.8
metadata CHANGED
@@ -1,58 +1,36 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: gather
3
- version: !ruby/object:Gem::Version
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.8
4
5
  prerelease:
5
- version: 0.0.7
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - John Anderson
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
-
13
- date: 2011-06-08 00:00:00 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
12
+ date: 2011-06-21 00:00:00.000000000 +02:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
16
  name: bones
17
- prerelease: false
18
- requirement: &id001 !ruby/object:Gem::Requirement
17
+ requirement: &69263020 !ruby/object:Gem::Requirement
19
18
  none: false
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
19
+ requirements:
20
+ - - ! '>='
21
+ - !ruby/object:Gem::Version
23
22
  version: 3.7.0
24
23
  type: :development
25
- version_requirements: *id001
26
- description: |-
27
- A gem that provides modules to make working with properties a bit easier.
28
-
29
- For example:
30
-
31
- class SumThing
32
- include Gather
33
- property :thing, :spla, :gumf, :troob
34
- end
35
-
36
- s = SumThing.new.gather :spla => 'five', :thing => 'sigma' do
37
- troob %w{one two three four}
38
- gumf 15 % 4
39
- end
40
-
41
- Or
42
-
43
- s = SumThing.new.gather :spla => 'five', :thing => 'sigma' do |s|
44
- s.troob = %w{one two three four}
45
- s.gumf = 15 % 4
46
- end
24
+ prerelease: false
25
+ version_requirements: *69263020
26
+ description: A gem that provides modules to make working with properties a bit easier.
47
27
  email: panic@semiosix.com
48
28
  executables: []
49
-
50
29
  extensions: []
51
-
52
- extra_rdoc_files:
30
+ extra_rdoc_files:
53
31
  - History.txt
54
32
  - Manifest.txt
55
- files:
33
+ files:
56
34
  - .gitignore
57
35
  - History.txt
58
36
  - LICENSE
@@ -62,42 +40,40 @@ files:
62
40
  - TODO
63
41
  - lib/changes.rb
64
42
  - lib/gather.rb
65
- - lib/version.rb
66
43
  - script/destroy
67
44
  - script/generate
68
45
  - test/test_changes.rb
69
46
  - test/test_gather.rb
70
47
  - test/test_helper.rb
71
48
  - version.txt
49
+ has_rdoc: true
72
50
  homepage: https://rubygems.org/gems/gather
73
51
  licenses: []
74
-
75
52
  post_install_message:
76
- rdoc_options:
53
+ rdoc_options:
77
54
  - --main
78
55
  - README
79
- require_paths:
56
+ require_paths:
80
57
  - lib
81
- required_ruby_version: !ruby/object:Gem::Requirement
58
+ required_ruby_version: !ruby/object:Gem::Requirement
82
59
  none: false
83
- requirements:
84
- - - ">="
85
- - !ruby/object:Gem::Version
86
- version: "0"
87
- required_rubygems_version: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - ! '>='
62
+ - !ruby/object:Gem::Version
63
+ version: '0'
64
+ required_rubygems_version: !ruby/object:Gem::Requirement
88
65
  none: false
89
- requirements:
90
- - - ">="
91
- - !ruby/object:Gem::Version
92
- version: "0"
66
+ requirements:
67
+ - - ! '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
93
70
  requirements: []
94
-
95
71
  rubyforge_project: gather
96
- rubygems_version: 1.7.2
72
+ rubygems_version: 1.6.2
97
73
  signing_key:
98
74
  specification_version: 3
99
75
  summary: http://gather.
100
- test_files:
101
- - test/test_changes.rb
76
+ test_files:
102
77
  - test/test_gather.rb
103
78
  - test/test_helper.rb
79
+ - test/test_changes.rb
@@ -1,3 +0,0 @@
1
- module Gather
2
- VERSION = '0.0.6'
3
- end