Class: SlackQuestionAbilities::Option

Inherits:
Object
  • Object
show all
Defined in:
src/abilities/slack_question_abilities.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(label, value, matcher = label) ⇒ Option

Construct a new instance of Option

Parameters:

  • label (String)

    the text that is presented to the user

  • value (Object)

    the value that is returned when a choice is made

  • matcher (String, Regexp) (defaults to: label)

    the matcher used for unnumbered option questions



17
18
19
20
21
# File 'src/abilities/slack_question_abilities.rb', line 17

def initialize(label, value, matcher = label)
  @label = label
  @value = value
  @matcher = matcher
end

Instance Attribute Details

#labelString (readonly) Also known as: to_s

Returns the text that is presented to the user

Returns:

  • (String)

    the text that is presented to the user



4
5
6
# File 'src/abilities/slack_question_abilities.rb', line 4

def label
  @label
end

#matcherString, Regexp (readonly)

Returns the matcher used for unnumbered option questions

Returns:

  • (String, Regexp)

    the matcher used for unnumbered option questions



10
11
12
# File 'src/abilities/slack_question_abilities.rb', line 10

def matcher
  @matcher
end

#valueObject (readonly)

Returns the value that is returned when a choice is made

Returns:

  • (Object)

    the value that is returned when a choice is made



7
8
9
# File 'src/abilities/slack_question_abilities.rb', line 7

def value
  @value
end