Class: PhishDotNetClient::Song
- Inherits:
-
Object
- Object
- PhishDotNetClient::Song
- Defined in:
- lib/phish_dot_net_client/song.rb
Overview
This class represents a set from the ‘setlistdata’ field.
Instance Attribute Summary collapse
-
#footnotes ⇒ Object
readonly
Returns the value of attribute footnotes.
-
#instance ⇒ Object
readonly
Returns the value of attribute instance.
-
#position_in_set ⇒ Object
readonly
Returns the value of attribute position_in_set.
-
#position_in_show ⇒ Object
readonly
Returns the value of attribute position_in_show.
-
#post_transition ⇒ SongTransition
The transition to the next song.
-
#pre_transition ⇒ SongTransition
The transition to the previous song.
-
#slug ⇒ Object
readonly
Returns the value of attribute slug.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Song
constructor
private
A new instance of Song.
-
#to_s ⇒ String
The song along with pre and post transitions.
Constructor Details
#initialize(attrs = {}) ⇒ Song
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Song.
56 57 58 59 60 61 62 63 64 |
# File 'lib/phish_dot_net_client/song.rb', line 56 def initialize(attrs={}) @title = attrs[:title] @url = attrs[:url] @slug = attrs[:slug] @instance = attrs[:instance] @position_in_set = attrs[:position_in_set] @position_in_show = attrs[:position_in_show] @footnotes = [] end |
Instance Attribute Details
#footnotes ⇒ Object (readonly)
Returns the value of attribute footnotes.
37 38 39 |
# File 'lib/phish_dot_net_client/song.rb', line 37 def footnotes @footnotes end |
#instance ⇒ Object (readonly)
Returns the value of attribute instance.
24 25 26 |
# File 'lib/phish_dot_net_client/song.rb', line 24 def instance @instance end |
#position_in_set ⇒ Object (readonly)
Returns the value of attribute position_in_set.
28 29 30 |
# File 'lib/phish_dot_net_client/song.rb', line 28 def position_in_set @position_in_set end |
#position_in_show ⇒ Object (readonly)
Returns the value of attribute position_in_show.
32 33 34 |
# File 'lib/phish_dot_net_client/song.rb', line 32 def position_in_show @position_in_show end |
#post_transition ⇒ SongTransition
Returns the transition to the next song.
45 46 47 |
# File 'lib/phish_dot_net_client/song.rb', line 45 def post_transition @post_transition end |
#pre_transition ⇒ SongTransition
Returns the transition to the previous song.
41 42 43 |
# File 'lib/phish_dot_net_client/song.rb', line 41 def pre_transition @pre_transition end |
#slug ⇒ Object (readonly)
Returns the value of attribute slug.
19 20 21 |
# File 'lib/phish_dot_net_client/song.rb', line 19 def slug @slug end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
10 11 12 |
# File 'lib/phish_dot_net_client/song.rb', line 10 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
14 15 16 |
# File 'lib/phish_dot_net_client/song.rb', line 14 def url @url end |
Instance Method Details
#to_s ⇒ String
Returns the song along with pre and post transitions.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/phish_dot_net_client/song.rb', line 67 def to_s s = StringIO.new if pre_transition s.print "#{pre_transition.from_song.title}(#{pre_transition.from_song.instance})..." else s.print "x..." end s.print "#{@title}(#{@instance})" if post_transition s.puts "...#{post_transition.to_song.title}(#{post_transition.to_song.instance})" else s.puts "...x" end s.puts return s.string end |