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.
21 22 23 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 21 def previous @previous end |
Class Method Details
.create_list(parent, files) ⇒ Object
8 9 10 11 12 13 14 15 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 8 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
27 28 29 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 27 def <=>(other) path <=> other.path end |
#filename ⇒ Object
23 24 25 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 23 def filename path.relative_path_from(parent.path) end |
#header_id ⇒ Object
39 40 41 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 39 def header_id header_title.variableize end |
#header_index ⇒ Object
43 44 45 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 43 def header_index parent.header_index + 1 end |
#index_id ⇒ Object
35 36 37 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 35 def index_id "index_#{header_id}" end |
#link_to_header ⇒ Object
31 32 33 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 31 def link_to_header "<a href=\"##{header_id}\" id=\"#{index_id}\">#{header_title}</a>" end |
#output_index ⇒ Object
51 52 53 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 51 def output_index erb_template('index.html.erb') end |
#output_main ⇒ Object
47 48 49 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 47 def output_main ::EhbrsRubyUtils::Music::LyricsBook::Resource.erb_template('main.html.erb', binding) end |
#type ⇒ Object
55 56 57 |
# File 'lib/ehbrs_ruby_utils/music/lyrics_book/resource.rb', line 55 def type self.class.name.demodulize.underscore end |