Class: Tumblargh::Renderer::Blocks::Audio
- Inherits:
-
Post
show all
- Defined in:
- lib/tumblargh/renderer/blocks/audio.rb
Instance Attribute Summary
#context, #node, #options
Instance Method Summary
collapse
Methods inherited from Post
#should_render?
#context_post, contextual_tag, #escape_html, #escape_url, #initialize, #method_missing, #render, #strip_html
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
in the class Tumblargh::Renderer::Base
Instance Method Details
#audio_player(color = :default) ⇒ Object
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/tumblargh/renderer/blocks/audio.rb', line 6
def audio_player(color=:default)
html = context.player
return html if color == :default
map = { :white => 'FFFFFF', :grey => 'CCCCCC', :black => '000000' }
color = map[color] unless map[color].nil?
html.gsub(/color=[A-Z]{6}/i, "color=#{color}")
end
|
#audio_player_black ⇒ Object
25
26
27
|
# File 'lib/tumblargh/renderer/blocks/audio.rb', line 25
def audio_player_black
audio_player(:black)
end
|
#audio_player_grey ⇒ Object
21
22
23
|
# File 'lib/tumblargh/renderer/blocks/audio.rb', line 21
def audio_player_grey
audio_player(:grey)
end
|
#audio_player_white ⇒ Object
17
18
19
|
# File 'lib/tumblargh/renderer/blocks/audio.rb', line 17
def audio_player_white
audio_player(:white)
end
|
37
38
39
|
# File 'lib/tumblargh/renderer/blocks/audio.rb', line 37
def formatted_play_count
play_count.to_s.reverse.scan(/.{1,3}/).join(',').reverse
end
|
#play_count_with_label ⇒ Object
41
42
43
44
|
# File 'lib/tumblargh/renderer/blocks/audio.rb', line 41
def play_count_with_label
num = formatted_play_count
"#{num} play#{num == 1 ? '' : 's'}"
end
|