Module: Media
- Included in:
- HTML
- Defined in:
- lib/media.rb
Defined Under Namespace
Classes: HTML
Constant Summary collapse
- Symbol_to_class_string =
add to this class the conversion from the filename (as a symbol) to the properly capitalized classname. If the class name is just capitalized and all lower case, not necessary.
{ }
Class Method Summary collapse
-
.new(tp = :jtp) ⇒ Object
:html => ‘HTML’.
Instance Method Summary collapse
-
#b(string) ⇒ Object
bold.
- #bold(string) ⇒ Object
- #br(string) ⇒ Object
- #bracket(string) ⇒ Object
- #call_it(method, string) ⇒ Object
- #footer ⇒ Object
-
#format(format_object, citations) ⇒ Object
create the final bibliography string in whatever media you desire the example here is html.
- #header ⇒ Object
-
#i(string) ⇒ Object
italicize.
- #italics(string) ⇒ Object
- #par(string) ⇒ Object
- #parenthesize(string) ⇒ Object
-
#u(string) ⇒ Object
underline.
- #underline(string) ⇒ Object
Class Method Details
.new(tp = :jtp) ⇒ Object
:html => ‘HTML’
12 13 14 15 16 17 18 |
# File 'lib/media.rb', line 12 def self.new(tp=:jtp) require "media/#{tp}" #puts( $".grep(/html/) ) klass_st = ((x = Symbol_to_class_string[tp]) ? x : tp.to_s.capitalize) klass = Media.const_get(klass_st) klass.new end |
Instance Method Details
#b(string) ⇒ Object
bold
56 57 58 |
# File 'lib/media.rb', line 56 def b(string) call_it(:bold, string) end |
#bold(string) ⇒ Object
69 70 71 |
# File 'lib/media.rb', line 69 def bold(string) "<span style=\"font-weight:bold;\">" + string + "</span>" end |
#br(string) ⇒ Object
42 43 44 |
# File 'lib/media.rb', line 42 def br(string) call_it(:bracket, string) end |
#bracket(string) ⇒ Object
38 39 40 |
# File 'lib/media.rb', line 38 def bracket(string) '[' + string + ']' end |
#call_it(method, string) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/media.rb', line 26 def call_it(method, string) if var = string send(method, var.to_s) else nil end end |
#footer ⇒ Object
23 24 |
# File 'lib/media.rb', line 23 def end |
#format(format_object, citations) ⇒ Object
create the final bibliography string in whatever media you desire the example here is html
79 80 81 82 83 84 |
# File 'lib/media.rb', line 79 def format(format_object, citations) cts = citations.map do |cit| " <li>" + format_object.format(cit) + "</li>" end "<ol>\n" + cts.join("\n") + "\n</ol>\n" end |
#header ⇒ Object
20 21 |
# File 'lib/media.rb', line 20 def header end |
#i(string) ⇒ Object
italicize
51 52 53 |
# File 'lib/media.rb', line 51 def i(string) call_it(:italics, string) end |
#italics(string) ⇒ Object
65 66 67 |
# File 'lib/media.rb', line 65 def italics(string) "<span style=\"font-style:italic;\">" + string + "</span>" end |
#par(string) ⇒ Object
46 47 48 |
# File 'lib/media.rb', line 46 def par(string) call_it(:parenthesize, string) end |
#parenthesize(string) ⇒ Object
34 35 36 |
# File 'lib/media.rb', line 34 def parenthesize(string) '(' + string + ')' end |
#u(string) ⇒ Object
underline
61 62 63 |
# File 'lib/media.rb', line 61 def u(string) call_it(:underline, string) end |
#underline(string) ⇒ Object
73 74 75 |
# File 'lib/media.rb', line 73 def underline(string) "<span style=\"text-decoration:underline;\">" + string + "</span>" end |