Class: Statsample::Formula

Inherits:
Object show all
Defined in:
lib/statsample/formula/formula.rb

Overview

To process formula language

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tokens) ⇒ Formula

Returns a new instance of Formula.



122
123
124
125
# File 'lib/statsample/formula/formula.rb', line 122

def initialize(tokens)
  @tokens = tokens
  @canonical_tokens = parse_formula
end

Instance Attribute Details

#canonical_tokensObject (readonly)

Returns the value of attribute canonical_tokens.



120
121
122
# File 'lib/statsample/formula/formula.rb', line 120

def canonical_tokens
  @canonical_tokens
end

#tokensObject (readonly)

Returns the value of attribute tokens.



120
121
122
# File 'lib/statsample/formula/formula.rb', line 120

def tokens
  @tokens
end

Instance Method Details

#canonical_to_sObject



127
128
129
# File 'lib/statsample/formula/formula.rb', line 127

def canonical_to_s
  canonical_tokens.join '+'
end