Class: Flexr::Source::StaticEval
- Inherits:
-
Object
- Object
- Flexr::Source::StaticEval
- Defined in:
- lib/flexr/source/static_eval.rb
Constant Summary collapse
- MISSING =
Object.new.freeze
Instance Attribute Summary collapse
-
#constants ⇒ Object
readonly
Returns the value of attribute constants.
Instance Method Summary collapse
- #call(node) ⇒ Object
-
#initialize(source, constants: {}, scope: []) ⇒ StaticEval
constructor
A new instance of StaticEval.
Constructor Details
#initialize(source, constants: {}, scope: []) ⇒ StaticEval
Returns a new instance of StaticEval.
10 11 12 13 14 |
# File 'lib/flexr/source/static_eval.rb', line 10 def initialize(source, constants: {}, scope: []) @source = source @constants = constants @scope = Array(scope).map(&:to_s) end |
Instance Attribute Details
#constants ⇒ Object (readonly)
Returns the value of attribute constants.
8 9 10 |
# File 'lib/flexr/source/static_eval.rb', line 8 def constants @constants end |
Instance Method Details
#call(node) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/flexr/source/static_eval.rb', line 16 def call(node) evaluate(node) rescue StaticResolutionError raise rescue StandardError => e raise_resolution("#{node.class}: #{e.}") end |