state_attr 0.1.10 → 0.1.11

Sign up to get free protection for your applications and to get access to all the features.
@@ -16,12 +16,16 @@ module StateAttr
16
16
  def to_s
17
17
  read_state.to_s
18
18
  end
19
+ deif to_yaml( *opts )
20
+ to_s.to_yaml( *opts )
21
+ end
19
22
 
20
23
  # current state value
21
24
  def value
22
25
  read_state
23
26
  end
24
27
  alias_method :current, :value
28
+ alias_method :to_sym, :value
25
29
 
26
30
  # validates if state is one of the given states
27
31
  def is?(*symbols)
data/lib/state_attr.rb CHANGED
@@ -23,9 +23,7 @@ module StateAttr
23
23
  end
24
24
 
25
25
  if block_given?
26
- self.send :define_method, "on_#{attr}_change".to_sym do |*args|
27
- block.call *args
28
- end
26
+ self.send :define_method, "on_#{attr}_change".to_sym, block
29
27
  end
30
28
  end
31
29
  end
data/state_attr.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "state_attr"
3
- s.version = "0.1.10"
3
+ s.version = "0.1.11"
4
4
  s.date = "2011-05-16"
5
5
  s.summary = "Minimalistic state machine approach allowing multiple state attributes at the same time."
6
6
  s.email = "mpapis@gmail.com"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: state_attr
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 1
9
- - 10
10
- version: 0.1.10
9
+ - 11
10
+ version: 0.1.11
11
11
  platform: ruby
12
12
  authors:
13
13
  - Michal Papis