maintain 0.2.8 → 0.2.9

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.8
1
+ 0.2.9
@@ -68,6 +68,7 @@ module Maintain
68
68
  state_value_for(state, :compare_value)
69
69
  end
70
70
 
71
+ # TODO: Sweet god, this is hideous and needs to be cleaned up!
71
72
  def method_missing(method, *args)
72
73
  if (method.to_s =~ /^(.+)\?$/)
73
74
  check = $1.to_sym
@@ -86,9 +87,14 @@ module Maintain
86
87
  end
87
88
  EOC
88
89
  return aggregates.include?(@value)
90
+ else
91
+ super
89
92
  end
93
+ elsif value_for(@value).respond_to?(method)
94
+ value_for(@value).send(method, *args)
95
+ else
96
+ super
90
97
  end
91
- super
92
98
  end
93
99
 
94
100
  def state_name_for(value)
data/maintain.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{maintain}
8
- s.version = "0.2.6"
8
+ s.version = "0.2.9"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Flip Sasser"]
12
- s.date = %q{2011-02-28}
12
+ s.date = %q{2011-06-02}
13
13
  s.description = %q{
14
14
  Maintain is a simple state machine mixin for Ruby objects. It supports comparisons, bitmasks,
15
15
  and hooks that really work. It can be used for multiple attributes and will always do its best to
@@ -38,6 +38,7 @@ Gem::Specification.new do |s|
38
38
  "spec/active_record_spec.rb",
39
39
  "spec/aggregates_spec.rb",
40
40
  "spec/bitwise_spec.rb",
41
+ "spec/class_methods_spec.rb",
41
42
  "spec/comparing_state_spec.rb",
42
43
  "spec/data_mapper_spec.rb",
43
44
  "spec/defining_states_spec.rb",
@@ -52,26 +53,10 @@ Gem::Specification.new do |s|
52
53
  ]
53
54
  s.homepage = %q{http://github.com/flipsasser/maintain}
54
55
  s.require_paths = ["lib"]
55
- s.rubygems_version = %q{1.3.7}
56
+ s.rubygems_version = %q{1.6.2}
56
57
  s.summary = %q{A Ruby state machine that lets your code do the driving}
57
- s.test_files = [
58
- "spec/active_record_spec.rb",
59
- "spec/aggregates_spec.rb",
60
- "spec/bitwise_spec.rb",
61
- "spec/comparing_state_spec.rb",
62
- "spec/data_mapper_spec.rb",
63
- "spec/defining_states_spec.rb",
64
- "spec/hooks_spec.rb",
65
- "spec/integer_spec.rb",
66
- "spec/maintain_spec.rb",
67
- "spec/object_spec.rb",
68
- "spec/proxy_spec.rb",
69
- "spec/setting_state_spec.rb",
70
- "spec/subclass_spec.rb"
71
- ]
72
58
 
73
59
  if s.respond_to? :specification_version then
74
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
75
60
  s.specification_version = 3
76
61
 
77
62
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
@@ -54,6 +54,14 @@ describe Maintain do
54
54
  }.should raise_error(NoMethodError)
55
55
  end
56
56
 
57
+ it "should pass valid methods to the actual value object" do
58
+ MaintainTest.maintain :existant_attribute do
59
+ state :new, :default => true
60
+ end
61
+ MaintainTest.new.existant_attribute.to_i.should == 3361
62
+ end
63
+
64
+
57
65
  describe "as bitmask" do
58
66
  it "should calculate a base-2 compatible integer" do
59
67
  maintainer = MaintainTest.maintain :permissions, :bitmask => true do
@@ -4,33 +4,33 @@ require 'lib/maintain'
4
4
 
5
5
  describe Maintain do
6
6
  before :each do
7
- class ::MaintainTest
7
+ class ::MaintainSubclassTest
8
8
  attr_accessor :existant_attribute
9
9
  extend Maintain
10
10
  end
11
11
 
12
- class ::MaintainTestSubclass < ::MaintainTest; end
12
+ class ::MaintainSubclassTestSubclass < ::MaintainSubclassTest; end
13
13
  end
14
14
 
15
15
  it "should inherit maintainers from parent classes" do
16
- MaintainTest.maintain :status do
16
+ MaintainSubclassTest.maintain :status do
17
17
  state :new
18
18
  state :old
19
19
  end
20
- MaintainTestSubclass.maintainers[:status].should_not be_nil
20
+ MaintainSubclassTestSubclass.maintainers[:status].should_not be_nil
21
21
  end
22
22
 
23
23
  it "should not propagate maintainers up the class system" do
24
- MaintainTest.maintain :status do
24
+ MaintainSubclassTest.maintain :status do
25
25
  state :new
26
26
  state :old
27
27
  end
28
- MaintainTestSubclass.maintain :foo do
28
+ MaintainSubclassTestSubclass.maintain :foo do
29
29
  state :bar
30
30
  state :baz
31
31
  end
32
- MaintainTest.maintainers[:foo].should be_nil
33
- MaintainTestSubclass.maintainers[:status].should_not be_nil
32
+ MaintainSubclassTest.maintainers[:foo].should be_nil
33
+ MaintainSubclassTestSubclass.maintainers[:status].should_not be_nil
34
34
  end
35
35
 
36
36
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: maintain
3
3
  version: !ruby/object:Gem::Version
4
- hash: 7
5
- prerelease: false
4
+ hash: 5
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 2
9
- - 8
10
- version: 0.2.8
9
+ - 9
10
+ version: 0.2.9
11
11
  platform: ruby
12
12
  authors:
13
13
  - Flip Sasser
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-28 00:00:00 -05:00
18
+ date: 2011-06-02 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -88,22 +88,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
88
  requirements: []
89
89
 
90
90
  rubyforge_project:
91
- rubygems_version: 1.3.7
91
+ rubygems_version: 1.6.2
92
92
  signing_key:
93
93
  specification_version: 3
94
94
  summary: A Ruby state machine that lets your code do the driving
95
- test_files:
96
- - spec/active_record_spec.rb
97
- - spec/aggregates_spec.rb
98
- - spec/bitwise_spec.rb
99
- - spec/class_methods_spec.rb
100
- - spec/comparing_state_spec.rb
101
- - spec/data_mapper_spec.rb
102
- - spec/defining_states_spec.rb
103
- - spec/hooks_spec.rb
104
- - spec/integer_spec.rb
105
- - spec/maintain_spec.rb
106
- - spec/object_spec.rb
107
- - spec/proxy_spec.rb
108
- - spec/setting_state_spec.rb
109
- - spec/subclass_spec.rb
95
+ test_files: []
96
+