Class: Grape::Util::LazyBlock

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

Instance Method Summary collapse

Constructor Details

#initialize(&new_block) ⇒ LazyBlock

Returns a new instance of LazyBlock.



6
7
8
# File 'lib/grape/util/lazy_block.rb', line 6

def initialize(&new_block)
  @block = new_block
end

Instance Method Details

#evaluateObject



14
15
16
# File 'lib/grape/util/lazy_block.rb', line 14

def evaluate
  @block.call({})
end

#evaluate_from(configuration) ⇒ Object



10
11
12
# File 'lib/grape/util/lazy_block.rb', line 10

def evaluate_from(configuration)
  @block.call(configuration)
end

#lazy?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/grape/util/lazy_block.rb', line 18

def lazy?
  true
end

#to_sObject



22
23
24
# File 'lib/grape/util/lazy_block.rb', line 22

def to_s
  evaluate.to_s
end