Class: AcnhCritterpedia::Critter

Inherits:
Object
  • Object
show all
Defined in:
lib/acnh_critterpedia/critter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_phraseObject (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_dayObject (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_yearObject (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

#locationObject (readonly)

Returns the value of attribute location.



3
4
5
# File 'lib/acnh_critterpedia/critter.rb', line 3

def location
  @location
end

#month_rangeObject

Returns the value of attribute month_range.



4
5
6
# File 'lib/acnh_critterpedia/critter.rb', line 4

def month_range
  @month_range
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/acnh_critterpedia/critter.rb', line 3

def name
  @name
end

#time_rangeObject (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



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