Class: Codename::Lister::BaseLister
- Inherits:
-
Object
- Object
- Codename::Lister::BaseLister
- Includes:
- Singleton
- Defined in:
- lib/codename/lister/base_lister.rb
Direct Known Subclasses
AdjectivesLister, ColorsLister, CyclonesLister, ElementsLister, RandomLister, StarsLister
Instance Method Summary collapse
- #description ⇒ Object
-
#list ⇒ Object
Public: list names.
- #name ⇒ Object
-
#random ⇒ Object
Public: Get an random item from the lister.
-
#size ⇒ Object
Public: Get the size of the list contains.
Instance Method Details
#description ⇒ Object
34 35 36 |
# File 'lib/codename/lister/base_lister.rb', line 34 def description "description of the lister" end |
#list ⇒ Object
Public: list names
Returns array of names
10 11 12 |
# File 'lib/codename/lister/base_lister.rb', line 10 def list raise "Implement me in subclass" end |
#name ⇒ Object
30 31 32 |
# File 'lib/codename/lister/base_lister.rb', line 30 def name "base" end |
#random ⇒ Object
Public: Get an random item from the lister
Returns random item from the list
17 18 19 20 |
# File 'lib/codename/lister/base_lister.rb', line 17 def random @__list ||= list @__list[rand(@__list.size)] end |
#size ⇒ Object
Public: Get the size of the list contains
Returns size of the list
25 26 27 28 |
# File 'lib/codename/lister/base_lister.rb', line 25 def size @__list ||= list @__list.size end |