class PhishDotNetClient::Song
This class represents a set from the 'setlistdata' field.
Attributes
footnotes[R]
@!attribute [r] footnotes
@return [Array<Integer>] the song's foonote numbers, used to lookup footnotes via {Setlist#footnotes}.
instance[R]
@!attribute [r] instance
@return [Integer] the instance number of the song. Normally will be +1+ since most shows don't have multiple instances of the same song.
position_in_set[R]
@!attribute [r] position_in_set
@return [String] the position of the song in it's set, indexed starting at 0
position_in_show[R]
@!attribute [r] position_in_show
@return [String] the position of the song in the show, indexed starting at 0
post_transition[RW]
@!attribute post_transition
@return [SongTransition] the transition to the next song
pre_transition[RW]
@!attribute pre_transition
@return [SongTransition] the transition to the previous song
slug[R]
@!attribute [r] slug
@return [String] the song slug (not unique). slug+instance can be used to create a unique slug when the setlist has the same song more than once.
title[R]
@!attribute [r] title
@return [String] the song title
url[R]
@!attribute [r] url
@return [String] the song url
Public Class Methods
new(attrs={})
click to toggle source
@api private
@param attrs [Hash<Symbol, Object>] the song attributes @option attrs [String] :title the song title @option attrs [String] :url the song url @option attrs [String] :slug the song slug @option attrs [Integer] :instance the instance number of the song @option attrs [Integer] :position_in_set set position of the song @option attrs [Integer] :position_in_show show position of the song
# 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
Public Instance Methods
to_s()
click to toggle source
@return [String] the song along with pre and post transitions
# 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