Class: Marvel101::Character
Constant Summary collapse
- DETAIL_ORDER =
[:real_name, :height, :weight, :abilities, :powers, :group_affiliations, :first_appearance, :origin]
Constants inherited from Topic
Instance Attribute Summary collapse
-
#details ⇒ Object
Returns the value of attribute details.
-
#list ⇒ Object
Returns the value of attribute list.
-
#team ⇒ Object
Returns the value of attribute team.
Attributes inherited from Topic
#description, #name, #scraped, #urls
Instance Method Summary collapse
- #display ⇒ Object
- #display_details ⇒ Object
- #display_empty_message ⇒ Object
- #no_info? ⇒ Boolean
- #valid_input?(input) ⇒ Boolean
Methods inherited from Topic
all, #char?, #display_description, #display_links, find_or_create_by_name, #format_output, #get_info, #has_team?, #initialize, #list?, #takes_input?, #team?
Constructor Details
This class inherits a constructor from Marvel101::Topic
Instance Attribute Details
#details ⇒ Object
Returns the value of attribute details.
5 6 7 |
# File 'lib/marvel_101/character.rb', line 5 def details @details end |
#list ⇒ Object
Returns the value of attribute list.
5 6 7 |
# File 'lib/marvel_101/character.rb', line 5 def list @list end |
#team ⇒ Object
Returns the value of attribute team.
5 6 7 |
# File 'lib/marvel_101/character.rb', line 5 def team @team end |
Instance Method Details
#display ⇒ Object
10 11 12 13 14 15 |
# File 'lib/marvel_101/character.rb', line 10 def display display_description display_details display_links if no_info? end |
#display_details ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/marvel_101/character.rb', line 17 def display_details DETAIL_ORDER.each do |type| if details.include?(type) title = type.to_s.split("_").join(" ").upcase format_output("#{title}: #{details[type]}") puts "" if "#{title}: #{details[type]}".size > 60 end end end |
#display_empty_message ⇒ Object
27 28 29 30 |
# File 'lib/marvel_101/character.rb', line 27 def puts "Sorry, Marvel doesn't seem to care about #{name}" puts "Type 'source' to open source in browser, but don't get your hopes up" end |
#no_info? ⇒ Boolean
32 33 34 |
# File 'lib/marvel_101/character.rb', line 32 def no_info? !description && details.empty? && urls.size <= 1 end |
#valid_input?(input) ⇒ Boolean
36 37 38 |
# File 'lib/marvel_101/character.rb', line 36 def valid_input?(input) false end |