Class: PlantToxicity::List
- Inherits:
-
Object
- Object
- PlantToxicity::List
- Defined in:
- lib/plant_toxicity/list.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#letter ⇒ Object
Returns the value of attribute letter.
-
#plants ⇒ Object
Returns the value of attribute plants.
-
#scraper ⇒ Object
readonly
Returns the value of attribute scraper.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(letter) ⇒ List
constructor
A new instance of List.
- #select_plant(input) ⇒ Object
Constructor Details
#initialize(letter) ⇒ List
Returns a new instance of List.
8 9 10 11 12 |
# File 'lib/plant_toxicity/list.rb', line 8 def initialize(letter) @letter = letter.upcase @plants = PlantToxicity::Scraper.get_list(@letter) @@all << self end |
Instance Attribute Details
#letter ⇒ Object
Returns the value of attribute letter.
3 4 5 |
# File 'lib/plant_toxicity/list.rb', line 3 def letter @letter end |
#plants ⇒ Object
Returns the value of attribute plants.
3 4 5 |
# File 'lib/plant_toxicity/list.rb', line 3 def plants @plants end |
#scraper ⇒ Object (readonly)
Returns the value of attribute scraper.
4 5 6 |
# File 'lib/plant_toxicity/list.rb', line 4 def scraper @scraper end |
Class Method Details
.all ⇒ Object
14 15 16 |
# File 'lib/plant_toxicity/list.rb', line 14 def self.all @@all end |
Instance Method Details
#select_plant(input) ⇒ Object
18 19 20 21 22 |
# File 'lib/plant_toxicity/list.rb', line 18 def select_plant(input) plant = self.plants[input] PlantToxicity::Scraper.get_plant_details(plant) plant end |