Class: EhbrsRubyUtils::Music::LyricsBook::Resource
- Inherits:
-
Object
- Object
- EhbrsRubyUtils::Music::LyricsBook::Resource
- Includes:
- Comparable
- Defined in:
- lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb
Instance Attribute Summary collapse
-
#previous ⇒ Object
Returns the value of attribute previous.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #filename ⇒ Object
- #header_id ⇒ Object
- #header_index ⇒ Object
- #index_id ⇒ Object
- #link_to_header ⇒ Object
- #output_index ⇒ Object
- #output_main ⇒ Object
- #type ⇒ Object
Instance Attribute Details
#previous ⇒ Object
Returns the value of attribute previous.
23 24 25 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 23 def previous @previous end |
Class Method Details
.create_list(parent, files) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 10 def create_list(parent, files) r = files.sort.map { |path| new(parent, path) }.select(&:valid?) previous = parent.first_previous r.map do |e| e.previous = previous previous = e end end |
Instance Method Details
#<=>(other) ⇒ Object
29 30 31 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 29 def <=>(other) path <=> other.path end |
#filename ⇒ Object
25 26 27 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 25 def filename path.relative_path_from(parent.path) end |
#header_id ⇒ Object
41 42 43 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 41 def header_id header_title.variableize end |
#header_index ⇒ Object
45 46 47 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 45 def header_index parent.header_index + 1 end |
#index_id ⇒ Object
37 38 39 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 37 def index_id "index_#{header_id}" end |
#link_to_header ⇒ Object
33 34 35 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 33 def link_to_header "<a href=\"##{header_id}\" id=\"#{index_id}\">#{header_title}</a>" end |
#output_index ⇒ Object
53 54 55 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 53 def output_index erb_template('index.html.erb') end |
#output_main ⇒ Object
49 50 51 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 49 def output_main ::EhbrsRubyUtils::Music::LyricsBook::Resource.erb_template('main.html.erb', binding) end |
#type ⇒ Object
57 58 59 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 57 def type self.class.name.demodulize.underscore end |