Class: RediPress::SimpleOption
- Inherits:
-
Object
- Object
- RediPress::SimpleOption
- Defined in:
- lib/redipress/simple_option.rb
Overview
This class is intended for use by configurations using selectable parameters.
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Define the name and slug attributes for reading.
-
#slug ⇒ Object
readonly
Define the name and slug attributes for reading.
Instance Method Summary collapse
-
#initialize(name, slug) ⇒ SimpleOption
constructor
Setup an instance of this class with a name and an option.
-
#to_s ⇒ Object
Convert the object to a string.
Constructor Details
#initialize(name, slug) ⇒ SimpleOption
Setup an instance of this class with a name and an option. The name will be shown in the list of options.
Arguments:
name: (String|Symbol)
slug: (String|Symbol)
Example:
>> RediPress::SimpleOption.new('RediPress', :redipress)
=> #<RediPress::SimpleOption:0x00000000000000>
24 25 26 27 |
# File 'lib/redipress/simple_option.rb', line 24 def initialize(name, slug) @name = name.to_s @slug = slug.to_s end |
Instance Attribute Details
#name ⇒ Object (readonly)
Define the name and slug attributes for reading
11 12 13 |
# File 'lib/redipress/simple_option.rb', line 11 def name @name end |
#slug ⇒ Object (readonly)
Define the name and slug attributes for reading
11 12 13 |
# File 'lib/redipress/simple_option.rb', line 11 def slug @slug end |
Instance Method Details
#to_s ⇒ Object
Convert the object to a string
Example:
>> option.to_s
=> 'RediPress'
35 36 37 |
# File 'lib/redipress/simple_option.rb', line 35 def to_s @name end |