Class: CPEE::StateMachine
- Inherits:
-
Object
- Object
- CPEE::StateMachine
- Defined in:
- lib/cpee/statemachine.rb
Instance Method Summary collapse
-
#initialize(file, readonly, &state) ⇒ StateMachine
constructor
A new instance of StateMachine.
- #readonly?(id) ⇒ Boolean
- #setable?(id, nval) ⇒ Boolean
Constructor Details
#initialize(file, readonly, &state) ⇒ StateMachine
Returns a new instance of StateMachine.
18 19 20 21 22 |
# File 'lib/cpee/statemachine.rb', line 18 def initialize(file,readonly,&state) @states = XML::Smart.open_unprotected(file) @state = state @readonly = readonly end |
Instance Method Details
#readonly?(id) ⇒ Boolean
29 30 31 |
# File 'lib/cpee/statemachine.rb', line 29 def readonly?(id) @readonly.include? @state.call(id) end |
#setable?(id, nval) ⇒ Boolean
24 25 26 27 |
# File 'lib/cpee/statemachine.rb', line 24 def setable?(id,nval) cval = @state.call(id) @states.find("/states/setable/#{cval}[#{nval}]").length > 0 end |