Class: Optimus::ParsedCalculator::Evaluators::ArgList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/expression_parser/evaluators.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ ArgList

Returns a new instance of ArgList.



18
19
20
# File 'lib/expression_parser/evaluators.rb', line 18

def initialize(*args)
  @args = args
end

Instance Attribute Details

#argsObject

Returns the value of attribute args.



17
18
19
# File 'lib/expression_parser/evaluators.rb', line 17

def args
  @args
end

Instance Method Details

#all_num?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/expression_parser/evaluators.rb', line 26

def all_num?
  @args.all? {|v| v.kind_of? Numeric }
end

#bool_castObject



34
35
36
# File 'lib/expression_parser/evaluators.rb', line 34

def bool_cast
  @args.map {|v| v.to_s.strip == '' ? false : v }
end

#cast_for_comparisonObject



30
31
32
# File 'lib/expression_parser/evaluators.rb', line 30

def cast_for_comparison
  @args.map {|v| floatify(v) }
end

#each(&block) ⇒ Object



22
23
24
# File 'lib/expression_parser/evaluators.rb', line 22

def each(&block)
  @args.each(&block)
end