Class: LittleBoxes::Entry
- Inherits:
-
Object
- Object
- LittleBoxes::Entry
- Defined in:
- lib/little_boxes/entry.rb
Instance Attribute Summary collapse
-
#block ⇒ Object
Returns the value of attribute block.
-
#box ⇒ Object
Returns the value of attribute box.
-
#configure ⇒ Object
Returns the value of attribute configure.
-
#eager ⇒ Object
Returns the value of attribute eager.
-
#memo ⇒ Object
Returns the value of attribute memo.
-
#mutex ⇒ Object
Returns the value of attribute mutex.
-
#name ⇒ Object
Returns the value of attribute name.
-
#then_block ⇒ Object
Returns the value of attribute then_block.
Instance Method Summary collapse
-
#initialize(name:, eager:, memo:, box:, block:, configure:, then_block:) ⇒ Entry
constructor
A new instance of Entry.
- #value ⇒ Object
Constructor Details
#initialize(name:, eager:, memo:, box:, block:, configure:, then_block:) ⇒ Entry
Returns a new instance of Entry.
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/little_boxes/entry.rb', line 5 def initialize(name:, eager:, memo:, box:, block:, configure:, then_block:) self.name = name self.memo = memo self.box = box self.eager = eager self.configure = configure self.then_block = then_block self.block = block self.mutex = Mutex.new if @memo end |
Instance Attribute Details
#block ⇒ Object
Returns the value of attribute block.
3 4 5 |
# File 'lib/little_boxes/entry.rb', line 3 def block @block end |
#box ⇒ Object
Returns the value of attribute box.
3 4 5 |
# File 'lib/little_boxes/entry.rb', line 3 def box @box end |
#configure ⇒ Object
Returns the value of attribute configure.
3 4 5 |
# File 'lib/little_boxes/entry.rb', line 3 def configure @configure end |
#eager ⇒ Object
Returns the value of attribute eager.
3 4 5 |
# File 'lib/little_boxes/entry.rb', line 3 def eager @eager end |
#memo ⇒ Object
Returns the value of attribute memo.
3 4 5 |
# File 'lib/little_boxes/entry.rb', line 3 def memo @memo end |
#mutex ⇒ Object
Returns the value of attribute mutex.
3 4 5 |
# File 'lib/little_boxes/entry.rb', line 3 def mutex @mutex end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/little_boxes/entry.rb', line 3 def name @name end |
#then_block ⇒ Object
Returns the value of attribute then_block.
3 4 5 |
# File 'lib/little_boxes/entry.rb', line 3 def then_block @then_block end |
Instance Method Details
#value ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/little_boxes/entry.rb', line 16 def value if @memo @mutex.synchronize { @block.call(@box) } else @block.call(@box) end end |