Class: Grape::Util::Lazy::Block
- Inherits:
-
Object
- Object
- Grape::Util::Lazy::Block
- Defined in:
- lib/grape/util/lazy/block.rb
Instance Method Summary collapse
- #evaluate ⇒ Object
- #evaluate_from(configuration) ⇒ Object
-
#initialize(&new_block) ⇒ Block
constructor
A new instance of Block.
- #lazy? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(&new_block) ⇒ Block
Returns a new instance of Block.
7 8 9 |
# File 'lib/grape/util/lazy/block.rb', line 7 def initialize(&new_block) @block = new_block end |
Instance Method Details
#evaluate ⇒ Object
15 16 17 |
# File 'lib/grape/util/lazy/block.rb', line 15 def evaluate @block.call({}) end |
#evaluate_from(configuration) ⇒ Object
11 12 13 |
# File 'lib/grape/util/lazy/block.rb', line 11 def evaluate_from(configuration) @block.call(configuration) end |
#lazy? ⇒ Boolean
19 20 21 |
# File 'lib/grape/util/lazy/block.rb', line 19 def lazy? true end |
#to_s ⇒ Object
23 24 25 |
# File 'lib/grape/util/lazy/block.rb', line 23 def to_s evaluate.to_s end |