class MapValuesToRuby
Constants
- ERRORS
- REVERSE_ERRORS
Attributes
constants[RW]
Public Instance Methods
blank()
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 20 def blank "nil" end
Also aliased as: null
boolean_false()
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 78 def boolean_false "false" end
boolean_true()
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 74 def boolean_true "true" end
constant(constant)
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 28 def constant(constant) map(constants[constant]) end
error(text)
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 70 def error(text) ERRORS[text] || (raise NotSupportedException.new("#{text.inspect} error not recognised")) end
inlined_blank()
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 24 def inlined_blank "0.0" end
map(ast)
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 7 def map(ast) if ast.is_a?(Array) operator = ast[0] if respond_to?(operator) send(operator,*ast[1..-1]) else raise NotSupportedException.new("#{operator} in #{ast.inspect} not supported") end else raise NotSupportedException.new("#{ast} not supported") end end
number(text)
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 34 def number(text) case text.to_s when /\./ text.to_f.to_s when /e/i text.to_f.to_s else text.to_i.to_s end end
percentage(text)
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 45 def percentage(text) (text.to_f / 100.0).to_s end
string(text)
click to toggle source
# File src/compile/ruby/map_values_to_ruby.rb, line 49 def string(text) text.inspect end