Class: Compass::LazyAttribute::LazyValue
- Inherits:
-
Object
- Object
- Compass::LazyAttribute::LazyValue
- Defined in:
- lib/compass/lazy_attribute.rb
Overview
A lazy evaluated value, evaluated in the given context when required.
Instance Method Summary collapse
- #get ⇒ Object
-
#initialize(ctx, value) ⇒ LazyValue
constructor
A new instance of LazyValue.
Constructor Details
#initialize(ctx, value) ⇒ LazyValue
Returns a new instance of LazyValue.
10 11 12 13 |
# File 'lib/compass/lazy_attribute.rb', line 10 def initialize(ctx, value) @ctx = ctx @value = value end |
Instance Method Details
#get ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/compass/lazy_attribute.rb', line 15 def get case @value when Symbol then @ctx.send(@value) when Proc then @ctx.instance_exec(&@value) else @value end end |