Class: TableOfTruth::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/table_of_truth/dsl.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDSL

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_namesArray<String or Symbol> (readonly)

Returns:

  • (Array<String or Symbol>)


10
11
12
# File 'lib/table_of_truth/dsl.rb', line 10

def expression_names
  @expression_names
end

#expressionsHash<(String or Symbol)->Proc (readonly)

Returns ].

Returns:

  • (Hash<(String or Symbol)->Proc)

    ]



8
9
10
# File 'lib/table_of_truth/dsl.rb', line 8

def expressions
  @expressions
end

#input_namesArray<String or Symbol> (readonly)

Returns:

  • (Array<String or Symbol>)


6
7
8
# File 'lib/table_of_truth/dsl.rb', line 6

def input_names
  @input_names
end

#inputsHash<(String or Symbol)->Array (readonly)

Returns ].

Returns:

  • (Hash<(String or Symbol)->Array)

    ]



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.

Parameters:

  • name (String or Symbol)
  • block (Proc)


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.

Parameters:

  • name (String or Symbol)


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