Class: Danica::Operator::Chained

Inherits:
Danica::Operator show all
Defined in:
lib/danica/operator/chained.rb

Direct Known Subclasses

Addition, Multiplication

Instance Method Summary collapse

Methods inherited from Danica::Operator

#==

Methods included from BaseOperations

#*, #**, #+, #-, #-@, #/

Methods included from VariablesHolder

#calculate, #initialize

Methods included from Common

#content, #formatted, #gnu, #tex, #to_gnu, #to_tex, #valued?

Instance Method Details

#include?(value) ⇒ Boolean

Returns:

  • (Boolean)


14
15
16
17
# File 'lib/danica/operator/chained.rb', line 14

def include?(value)
  value = wrap_value(value)
  variables.include?(value.content)
end

#to(format, **options) ⇒ Object



19
20
21
22
# File 'lib/danica/operator/chained.rb', line 19

def to(format, **options)
  extractor = string_extractor(format, **options)
  variables.procedural_join(extractor, &join_proc(symbol(format)))
end

#to_fObject



10
11
12
# File 'lib/danica/operator/chained.rb', line 10

def to_f
  chain(variables.map(&:to_f))
end

#variablesObject



24
25
26
# File 'lib/danica/operator/chained.rb', line 24

def variables
  @variables.map(&:content)
end

#variables=(vars) ⇒ Object



6
7
8
# File 'lib/danica/operator/chained.rb', line 6

def variables=(vars)
  @variables = vars.map { |v| wrap_value(v) }
end