Class: Peck::Rails::Controller::LazyValue

Inherits:
Object
  • Object
show all
Defined in:
lib/peck_on_rails/controller.rb

Overview

Stores expression to be evaluated later in the correct context

Instance Method Summary collapse

Constructor Details

#initialize(expression) ⇒ LazyValue

Returns a new instance of LazyValue.


29
30
31
# File 'lib/peck_on_rails/controller.rb', line 29

def initialize(expression)
  @expression = expression
end

Instance Method Details

#inspectObject


37
38
39
# File 'lib/peck_on_rails/controller.rb', line 37

def inspect
  @expression
end

#to_param(spec) ⇒ Object


33
34
35
# File 'lib/peck_on_rails/controller.rb', line 33

def to_param(spec)
  spec.instance_eval(@expression)
end