Class: Fire::State
- Inherits:
-
Object
- Object
- Fire::State
- Defined in:
- lib/fire/state.rb
Overview
Fire’s logic system is a *set logic* system. That means an empty set, ‘[]` is treated as `false` and a non-empty set is `true`.
Fire handles complex logic by building-up lazy logic constructs. It’s logical operators are defined using single charcter symbols, e.g. ‘&` and `|`.
Direct Known Subclasses
Instance Method Summary collapse
-
#&(other) ⇒ Object
set and.
- #call ⇒ Object
-
#initialize(&procedure) ⇒ State
constructor
A new instance of State.
- #set(value) ⇒ Object private
-
#|(other) ⇒ Object
set or.
Constructor Details
#initialize(&procedure) ⇒ State
Returns a new instance of State.
11 12 13 |
# File 'lib/fire/state.rb', line 11 def initialize(&procedure) @procedure = procedure end |
Instance Method Details
#&(other) ⇒ Object
set and
25 26 27 |
# File 'lib/fire/state.rb', line 25 def &(other) State.new{ set(self.call) & set(other.call) } end |
#call ⇒ Object
15 16 17 |
# File 'lib/fire/state.rb', line 15 def call set @procedure.call end |