Class: Codename::Lister::BaseLister

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/codename/lister/base_lister.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



34
35
36
# File 'lib/codename/lister/base_lister.rb', line 34

def description
  "description of the lister"
end

#listObject

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

#nameObject



30
31
32
# File 'lib/codename/lister/base_lister.rb', line 30

def name
  "base"
end

#randomObject

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

#sizeObject

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