Class: Object

Inherits:
BasicObject
Defined in:
lib/formula_eval.rb,
lib/formula_eval.rb,
lib/formula_eval.rb,
lib/formula_eval.rb,
lib/formula_eval/wrapper.rb,
lib/formula_eval/multi_eval.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#calculating_formulaObject

Returns the value of attribute calculating_formula.



5
6
7
# File 'lib/formula_eval.rb', line 5

def calculating_formula
  @calculating_formula
end

Instance Method Details

#blank?Boolean

Returns:

  • (Boolean)


112
113
114
# File 'lib/formula_eval.rb', line 112

def blank?
  to_s.strip == ''
end

#klassObject



106
107
108
# File 'lib/formula_eval.rb', line 106

def klass
  self.class
end

#my_instance_eval(*args, &b) ⇒ Object



121
122
123
# File 'lib/formula_eval.rb', line 121

def my_instance_eval(*args,&b)
  instance_eval(*args,&b)
end

#present?Boolean

Returns:

  • (Boolean)


115
116
117
# File 'lib/formula_eval.rb', line 115

def present?
  !blank?
end

#smart_respond_to?(k, args) ⇒ Boolean

Returns:

  • (Boolean)


67
68
69
70
71
72
73
74
75
76
77
78
# File 'lib/formula_eval/multi_eval.rb', line 67

def smart_respond_to?(k,args)
  sup = respond_to?(k)
  if k.to_s == '[]'
    return false if args.first.kind_of?(Numeric) && kind_of?(Hash)
    return false if !args.first.kind_of?(Numeric) && kind_of?(Array)
    return false if !args.first.kind_of?(Numeric) && kind_of?(Numeric)
    return false if !args.first.kind_of?(Numeric) && kind_of?(String)
    sup
  else
    sup
  end
end

#to_unwrappedObject



160
161
162
# File 'lib/formula_eval/wrapper.rb', line 160

def to_unwrapped
  to_unwrapped_inner.tap { |x| mylog 'unwrap', :klass => self.klass, :unwrapped => x.class }
end

#to_unwrapped_innerObject



153
154
155
156
157
158
159
# File 'lib/formula_eval/wrapper.rb', line 153

def to_unwrapped_inner
  if Wrapper.wrapped?(self)
    obj.to_unwrapped
  else
    self
  end
end

#to_wrappedObject



150
151
152
# File 'lib/formula_eval/wrapper.rb', line 150

def to_wrapped
  Wrapper.new(self)
end