Class: ActionTree::EvalScope Private
- Inherits:
-
Object
- Object
- ActionTree::EvalScope
- Defined in:
- lib/action_tree/eval_scope.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
The execution scope for running matches. Built dynamically for each match by mixing in modules and setting variables.
Instance Method Summary collapse
-
#initialize(*sources) ⇒ EvalScope
constructor
private
Build a new EvalScope from the given sources.
Constructor Details
#initialize(*sources) ⇒ EvalScope
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Build a new EvalScope from the given sources. The sources can be:
- Hash: instance variable names and values (:name becomes @name)
- Module: will be extended
- Array: flattened and used just the same
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/action_tree/eval_scope.rb', line 14 def initialize(*sources) Array(sources).flatten.each do |s| case s when Hash s.each {|k,v| instance_variable_set(:"@#{k}", v) } when Module then extend s else raise 'invalid scope source ' + s.inspect end end end |