Class: InheritableAccessors::InheritableOptionAccessor::LetOption
- Inherits:
-
Object
- Object
- InheritableAccessors::InheritableOptionAccessor::LetOption
- Defined in:
- lib/inheritable_accessors/inheritable_option_accessor.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
readonly
Returns the value of attribute block.
Instance Method Summary collapse
-
#initialize(block) ⇒ LetOption
constructor
A new instance of LetOption.
- #with_context(context) ⇒ Object
Constructor Details
#initialize(block) ⇒ LetOption
Returns a new instance of LetOption.
35 36 37 38 |
# File 'lib/inheritable_accessors/inheritable_option_accessor.rb', line 35 def initialize(block) @block = block @memoized = {} end |
Instance Attribute Details
#block ⇒ Object (readonly)
Returns the value of attribute block.
33 34 35 |
# File 'lib/inheritable_accessors/inheritable_option_accessor.rb', line 33 def block @block end |
Instance Method Details
#with_context(context) ⇒ Object
40 41 42 43 44 |
# File 'lib/inheritable_accessors/inheritable_option_accessor.rb', line 40 def with_context(context) @memoized[context] ||= begin context.instance_exec(&block) end end |