Class: Grape::Util::Lazy::Block

Inherits:
Object
  • Object
show all
Defined in:
lib/grape/util/lazy/block.rb

Instance Method Summary collapse

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

#evaluateObject



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

Returns:

  • (Boolean)


19
20
21
# File 'lib/grape/util/lazy/block.rb', line 19

def lazy?
  true
end

#to_sObject



23
24
25
# File 'lib/grape/util/lazy/block.rb', line 23

def to_s
  evaluate.to_s
end