Class: Humanized::RubyCompiler::Environment
- Defined in:
- lib/more/humanized/ruby_compiler.rb
Instance Method Summary collapse
- #__eval__(str) ⇒ Object
-
#initialize(humanizer, variables) ⇒ Environment
constructor
A new instance of Environment.
- #method_missing(name, *args, &block) ⇒ Object
Constructor Details
#initialize(humanizer, variables) ⇒ Environment
Returns a new instance of Environment.
23 24 25 26 |
# File 'lib/more/humanized/ruby_compiler.rb', line 23 def initialize(humanizer, variables) @humanizer = humanizer @variables = variables end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/more/humanized/ruby_compiler.rb', line 28 def method_missing(name, *args, &block) if @variables.key? name return @variables[name] else return eval("@humanizer.interpolater.object.#{name.to_s}(@humanizer,*args,&block)") end super end |
Instance Method Details
#__eval__(str) ⇒ Object
37 38 39 |
# File 'lib/more/humanized/ruby_compiler.rb', line 37 def __eval__(str) eval(str) end |