Class: AcnhCritterpedia::Critter
- Inherits:
-
Object
- Object
- AcnhCritterpedia::Critter
- Defined in:
- lib/acnh_critterpedia/critter.rb
Instance Attribute Summary collapse
-
#catch_phrase ⇒ Object
readonly
Returns the value of attribute catch_phrase.
-
#is_all_day ⇒ Object
readonly
Returns the value of attribute is_all_day.
-
#is_all_year ⇒ Object
readonly
Returns the value of attribute is_all_year.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#month_range ⇒ Object
Returns the value of attribute month_range.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#time_range ⇒ Object
readonly
Returns the value of attribute time_range.
Instance Method Summary collapse
-
#initialize(hash) ⇒ Critter
constructor
A new instance of Critter.
- #print_attributes ⇒ Object
Constructor Details
#initialize(hash) ⇒ Critter
Returns a new instance of Critter.
6 7 8 9 10 |
# File 'lib/acnh_critterpedia/critter.rb', line 6 def initialize(hash) hash.each do |key, value| self.instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#catch_phrase ⇒ Object (readonly)
Returns the value of attribute catch_phrase.
3 4 5 |
# File 'lib/acnh_critterpedia/critter.rb', line 3 def catch_phrase @catch_phrase end |
#is_all_day ⇒ Object (readonly)
Returns the value of attribute is_all_day.
3 4 5 |
# File 'lib/acnh_critterpedia/critter.rb', line 3 def is_all_day @is_all_day end |
#is_all_year ⇒ Object (readonly)
Returns the value of attribute is_all_year.
3 4 5 |
# File 'lib/acnh_critterpedia/critter.rb', line 3 def is_all_year @is_all_year end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
3 4 5 |
# File 'lib/acnh_critterpedia/critter.rb', line 3 def location @location end |
#month_range ⇒ Object
Returns the value of attribute month_range.
4 5 6 |
# File 'lib/acnh_critterpedia/critter.rb', line 4 def month_range @month_range end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/acnh_critterpedia/critter.rb', line 3 def name @name end |
#time_range ⇒ Object (readonly)
Returns the value of attribute time_range.
3 4 5 |
# File 'lib/acnh_critterpedia/critter.rb', line 3 def time_range @time_range end |
Instance Method Details
#print_attributes ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/acnh_critterpedia/critter.rb', line 12 def print_attributes puts <<-CRITTER_INFO #{"Name:".light_cyan} #{name.capitalize} #{"Months Available:".light_cyan} #{is_all_year ? "All Year" : month_range} #{"Hours Available:".light_cyan} #{is_all_day ? "All Day" : time_range} #{"Location:".light_cyan} #{location == nil ? "Ocean" : location} #{"Catch Phrase:".light_cyan} #{catch_phrase} CRITTER_INFO end |