Class: RedBird::VerticalMenu::Option

Inherits:
Object
  • Object
show all
Defined in:
lib/red_bird/vertical_menu.rb

Overview

An option to be used in RedBird::VerticalMenu.

Author:

  • Frederico Linhares

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(text, &action) ⇒ Option

Returns a new instance of Option.

Parameters:

  • text (String)

    option name

  • action (Proc)

    code to use when this option is selected

Author:

  • Frederico Linhares



24
25
26
27
28
# File 'lib/red_bird/vertical_menu.rb', line 24

def initialize(text, &action)
  @text = text
  @action = action
  @priority = 100
end

Instance Attribute Details

#actionProc

Returns code for option selection.

Returns:

  • (Proc)

    code for option selection



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/red_bird/vertical_menu.rb', line 18

class Option
  attr_accessor :action, :text

  # @param text [String] option name
  # @param action [Proc] code to use when this option is selected
  # @author Frederico Linhares
  def initialize(text, &action)
    @text = text
    @action = action
    @priority = 100
  end
end

#textString

Returns option name.

Returns:

  • (String)

    option name



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/red_bird/vertical_menu.rb', line 18

class Option
  attr_accessor :action, :text

  # @param text [String] option name
  # @param action [Proc] code to use when this option is selected
  # @author Frederico Linhares
  def initialize(text, &action)
    @text = text
    @action = action
    @priority = 100
  end
end