Class: Livetext::Functions
- Inherits:
-
Object
- Object
- Livetext::Functions
- Defined in:
- lib/functions.rb
Overview
Functions will go here… user-def AND pre-def??
Constant Summary collapse
- Formats =
::Livetext::Standard::SimpleFormats
Class Attribute Summary collapse
-
.context ⇒ Object
Returns the value of attribute context.
-
.param ⇒ Object
Returns the value of attribute param.
Instance Method Summary collapse
- #b ⇒ Object
- #bi ⇒ Object
- #bis ⇒ Object
- #bit ⇒ Object
- #bits ⇒ Object
- #br ⇒ Object
- #bs ⇒ Object
- #bt ⇒ Object
- #bts ⇒ Object
- #date ⇒ Object
- #i ⇒ Object
- #is ⇒ Object
- #it ⇒ Object
- #its ⇒ Object
- #link ⇒ Object
- #s ⇒ Object
- #simple_format(*args) ⇒ Object
- #t ⇒ Object
- #time ⇒ Object
- #ts ⇒ Object
-
#yt ⇒ Object
def asset param = self.class.param # FIXME how should this work? end.
Class Attribute Details
.context ⇒ Object
Returns the value of attribute context.
10 11 12 |
# File 'lib/functions.rb', line 10 def context @context end |
.param ⇒ Object
Returns the value of attribute param.
10 11 12 |
# File 'lib/functions.rb', line 10 def param @param end |
Instance Method Details
#b ⇒ Object
55 |
# File 'lib/functions.rb', line 55 def b; simple_format(:b); end |
#bi ⇒ Object
59 |
# File 'lib/functions.rb', line 59 def bi; simple_format(:b, :i); end |
#bis ⇒ Object
66 |
# File 'lib/functions.rb', line 66 def bis; simple_format(:b, :i, :s); end |
#bit ⇒ Object
65 |
# File 'lib/functions.rb', line 65 def bit; simple_format(:b, :i, :t); end |
#bits ⇒ Object
69 |
# File 'lib/functions.rb', line 69 def bits; simple_format(:b, :i, :t, :s); end |
#br ⇒ Object
27 28 29 30 31 32 |
# File 'lib/functions.rb', line 27 def br n = self.class.param n = "1" if n.empty? n = n.to_i "<br>"*n end |
#bs ⇒ Object
61 |
# File 'lib/functions.rb', line 61 def bs; simple_format(:b, :s); end |
#bt ⇒ Object
60 |
# File 'lib/functions.rb', line 60 def bt; simple_format(:b, :t); end |
#bts ⇒ Object
67 |
# File 'lib/functions.rb', line 67 def bts; simple_format(:b, :t, :s); end |
#date ⇒ Object
13 14 15 |
# File 'lib/functions.rb', line 13 def date Time.now.strftime("%F") end |
#i ⇒ Object
56 |
# File 'lib/functions.rb', line 56 def i; simple_format(:i); end |
#is ⇒ Object
63 |
# File 'lib/functions.rb', line 63 def is; simple_format(:i, :s); end |
#it ⇒ Object
62 |
# File 'lib/functions.rb', line 62 def it; simple_format(:i, :t); end |
#its ⇒ Object
68 |
# File 'lib/functions.rb', line 68 def its; simple_format(:i, :t, :s); end |
#link ⇒ Object
21 22 23 24 25 |
# File 'lib/functions.rb', line 21 def link param = self.class.param text, url = param.split("|", 2) # reverse these? "<a href='#{url}'>#{text}</a>" end |
#s ⇒ Object
58 |
# File 'lib/functions.rb', line 58 def s; simple_format(:s); end |
#simple_format(*args) ⇒ Object
44 45 46 47 48 49 50 51 52 53 |
# File 'lib/functions.rb', line 44 def simple_format(*args) param = self.class.param param ||= "NO PARAMETER" pairs = Formats.values_at(*args) str = param.dup pairs.reverse.each do |pair| str = "#{pair.first}#{str}#{pair.last}" end str end |
#t ⇒ Object
57 |
# File 'lib/functions.rb', line 57 def t; simple_format(:t); end |
#time ⇒ Object
17 18 19 |
# File 'lib/functions.rb', line 17 def time Time.now.strftime("%T") end |
#ts ⇒ Object
64 |
# File 'lib/functions.rb', line 64 def ts; simple_format(:t, :s); end |
#yt ⇒ Object
def asset
param = self.class.param
# FIXME how should this work?
end
39 40 41 42 |
# File 'lib/functions.rb', line 39 def yt param = self.class.param "https://www.youtube.com/watch?v=#{param}" end |