mtrack 2.0.0 → 2.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7e65f515296198e42617b8a6310e5972b86fa5b
4
- data.tar.gz: 70911119c9524b644cfe508c188ade1ed1c1190b
3
+ metadata.gz: fa9cf6b841f88c763721244b23a30998ea8c4618
4
+ data.tar.gz: 0c6eb53464c8ce3a3643970fff927b50336351f4
5
5
  SHA512:
6
- metadata.gz: a4b53ae6efa5206816f90afb16068cfd00a6e3e1bad8e08d170b02337f93291341673de1d7e1842325927ef81e6a7470c014afe46719736a4d46379286d00564
7
- data.tar.gz: 010a939bdfb9e349a159765b78fa4612e36be6ed899d239de9dc472e84b1fb914be2a2ee7d8400420f6c8705d59ab7413348e1ca332636f32490a2f5b9134509
6
+ metadata.gz: 532d2598f3f3b649ec3e119706ffeabd3f1d2d1abf7217143c7d3b51490a0b49d9ab23507e0231d22b8e261df59ec9ddeb53ec3649f42635da33bbfa8b26e389
7
+ data.tar.gz: 127f0f6e9ceef3acc7008aa24b64269d6239b9de04b7f398a0f52963456cc12c47b90a535a404b1fbb0699c59343d91ebc78d58f0b53b34430cbaa5ac884867a
data/README.md CHANGED
@@ -118,15 +118,15 @@ class SimpleStateMachine
118
118
  alias_method :allow_while, :track_methods
119
119
 
120
120
  def actions(transitions)
121
- transitions.each do |action, state|
122
- define_method action, transition_implementation(action, state)
121
+ transitions.each do |action, new_state|
122
+ define_method action, transition_implementation(action, new_state)
123
123
  end
124
124
  end
125
125
 
126
126
  def transition_implementation(action, new_state)
127
127
  proc do
128
- if self.class.tracked_methods(state).include? action
129
- self.state = new_state
128
+ if self.class.tracked_methods(current_state).include? action
129
+ self.current_state = new_state
130
130
  state_changed action
131
131
  else
132
132
  state_not_changed action
@@ -136,12 +136,12 @@ class SimpleStateMachine
136
136
  end
137
137
 
138
138
  def initialize(state)
139
- self.state = state
139
+ self.current_state = state
140
140
  end
141
141
 
142
142
  private
143
143
 
144
- attr_accessor :state
144
+ attr_accessor :current_state
145
145
  end
146
146
  ```
147
147
 
@@ -153,12 +153,12 @@ class Box < SimpleStateMachine
153
153
  super :locked
154
154
  end
155
155
 
156
- allow_while(:locked) { actions :unlock => :closed }
157
- allow_while(:closed) { actions :lock => :locked, :open => :open }
158
- allow_while(:open) { actions :close => :closed }
156
+ allow_while(:locked) { actions unlock: :closed }
157
+ allow_while(:closed) { actions lock: :locked, open: :open }
158
+ allow_while(:open) { actions close: :closed }
159
159
 
160
160
  def look
161
- "The box is #{state}."
161
+ "The box is #{current_state}."
162
162
  end
163
163
 
164
164
  private
@@ -168,7 +168,7 @@ class Box < SimpleStateMachine
168
168
  end
169
169
 
170
170
  def state_not_changed(action)
171
- "You can't #{action} the box while it is #{state}!"
171
+ "You can't #{action} the box while it is #{current_state}!"
172
172
  end
173
173
  end
174
174
  ```
@@ -20,5 +20,5 @@
20
20
  # D.tracked_methods #=> #<Set: {:method_1, :method_2, :method_3}>
21
21
  module MTrack
22
22
  # Current version of MTrack.
23
- VERSION = "2.0.0"
23
+ VERSION = "2.0.1"
24
24
  end
data/tasks/coverage.rb CHANGED
@@ -1,9 +1,5 @@
1
1
  desc "Run tests and generate coverage report"
2
2
  task :coverage do
3
- if RUBY_VERSION >= "1.9"
4
- ENV["COVERAGE"] = "true"
5
- else
6
- warn "Ruby version 1.9+ is needed in order to generate coverage report."
7
- end
3
+ ENV["COVERAGE"] = "true"
8
4
  Rake::Task[:spec].invoke
9
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mtrack
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gabriel de Oliveira
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-12-19 00:00:00.000000000 Z
11
+ date: 2014-12-21 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: |
14
14
  MTrack extends the functionality of modules and classes and enables them to define public methods within groups. These