Class: Moonrope::Helper

Inherits:
Object
  • Object
show all
Defined in:
lib/moonrope/helper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, controller, options = {}) { ... } ⇒ Helper

Initialize a new helper

Parameters:

  • name (Symbol)

    the name of the helper

  • controller (Moonrope::Controller)

    the controller the helper belongs to

Yields:

  • stores the block for use later



23
24
25
26
27
28
# File 'lib/moonrope/helper.rb', line 23

def initialize(name, controller, options = {}, &block)
  @name = name
  @controller = controller
  @options = options
  @block = block
end

Instance Attribute Details

#blockProc (readonly)

Returns the proc to execute.

Returns:

  • (Proc)

    the proc to execute



11
12
13
# File 'lib/moonrope/helper.rb', line 11

def block
  @block
end

#controllerMoonrope::Controller (readonly)

Returns the controller this helper belongs to.

Returns:



8
9
10
# File 'lib/moonrope/helper.rb', line 8

def controller
  @controller
end

#nameSymbol (readonly)

Returns the name of the helper.

Returns:

  • (Symbol)

    the name of the helper



5
6
7
# File 'lib/moonrope/helper.rb', line 5

def name
  @name
end

#optionsHash (readonly)

Returns options for this helper.

Returns:

  • (Hash)

    options for this helper



14
15
16
# File 'lib/moonrope/helper.rb', line 14

def options
  @options
end