Class: TableOfTruth::DSL
- Inherits:
-
Object
- Object
- TableOfTruth::DSL
- Defined in:
- lib/table_of_truth/dsl.rb
Instance Attribute Summary collapse
- #expression_names ⇒ Array<String or Symbol> readonly
-
#expressions ⇒ Hash<(String or Symbol)->Proc
readonly
].
- #input_names ⇒ Array<String or Symbol> readonly
-
#inputs ⇒ Hash<(String or Symbol)->Array
readonly
].
Instance Method Summary collapse
- #expression(name, &block) ⇒ void
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #input(name, values = [false, true]) ⇒ void
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
12 13 14 15 16 17 |
# File 'lib/table_of_truth/dsl.rb', line 12 def initialize @inputs = {} @input_names = [] @expressions = {} @expression_names = [] end |
Instance Attribute Details
#expression_names ⇒ Array<String or Symbol> (readonly)
10 11 12 |
# File 'lib/table_of_truth/dsl.rb', line 10 def expression_names @expression_names end |
#expressions ⇒ Hash<(String or Symbol)->Proc (readonly)
Returns ].
8 9 10 |
# File 'lib/table_of_truth/dsl.rb', line 8 def expressions @expressions end |
#input_names ⇒ Array<String or Symbol> (readonly)
6 7 8 |
# File 'lib/table_of_truth/dsl.rb', line 6 def input_names @input_names end |
#inputs ⇒ Hash<(String or Symbol)->Array (readonly)
Returns ].
4 5 6 |
# File 'lib/table_of_truth/dsl.rb', line 4 def inputs @inputs end |
Instance Method Details
#expression(name, &block) ⇒ void
This method returns an undefined value.
22 23 24 25 |
# File 'lib/table_of_truth/dsl.rb', line 22 def expression(name, &block) @expressions[name] = block @expression_names << name end |
#input(name, values = [false, true]) ⇒ void
This method returns an undefined value.
29 30 31 32 |
# File 'lib/table_of_truth/dsl.rb', line 29 def input(name, values = [false, true]) @inputs[name] = values @input_names << name end |