Class: RediPress::SimpleOption

Inherits:
Object
  • Object
show all
Defined in:
lib/redipress/simple_option.rb

Overview

This class is intended for use by configurations using selectable parameters.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#nameObject (readonly)

Define the name and slug attributes for reading



11
12
13
# File 'lib/redipress/simple_option.rb', line 11

def name
  @name
end

#slugObject (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_sObject

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