Class: Object
- Inherits:
- BasicObject
- Defined in:
- lib/docgenerator/standard.rb
Overview
Extend all objects by the methods
-
to_doc
-
to_html
-
to_latex
-
to_wiki
-
to_creole
-
to_text
-
to_context
Redefine is_a?: Allows comparison with a symbol.
Instance Method Summary collapse
-
#is_a?(testvalue) ⇒ Boolean
Redefine the standard is_a? to allow to compare with Symbol.
- #old_is_a? ⇒ Object
-
#to_context(options = {}) ⇒ Object
Extend each object with #to_context.
-
#to_creole(options = {}) ⇒ Object
Extend each object with #to_creole.
-
#to_doc(target, options = {}) ⇒ Object
to_doc returns the object as a string.
-
#to_html(options = {}) ⇒ Object
Extend each object with #to_html.
-
#to_latex(options = {}) ⇒ Object
Extend each object with #to_latex.
-
#to_text(options = {}) ⇒ Object
Extend each object with #to_text.
-
#to_wiki(options = {}) ⇒ Object
Extend each object with #to_wiki.
Instance Method Details
#is_a?(testvalue) ⇒ Boolean
Redefine the standard is_a? to allow to compare with Symbol.
Returns also true, if you compare Docgenerator::Element with a Symbol and one of the ids if the element corresponds to the Symbol.
Example:
newline = element(:br)
newline.is_a?(:newline) #true
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/docgenerator/standard.rb', line 31 def is_a?( testvalue) if testvalue.old_is_a?(Symbol) if old_is_a?(Docgenerator::Element) return element_ids.include?(testvalue) else return false end else #old/normal behaviour. return old_is_a?(testvalue) end end |
#old_is_a? ⇒ Object
19 |
# File 'lib/docgenerator/standard.rb', line 19 alias :old_is_a? :is_a? |
#to_context(options = {}) ⇒ Object
Extend each object with #to_context
59 |
# File 'lib/docgenerator/standard.rb', line 59 def to_context( = {}); to_doc(:context, ); end |
#to_creole(options = {}) ⇒ Object
Extend each object with #to_creole
65 |
# File 'lib/docgenerator/standard.rb', line 65 def to_creole( = {}); to_doc(:creole, ); end |
#to_doc(target, options = {}) ⇒ Object
to_doc returns the object as a string. will be redefined for Docgenerator::Element
47 48 49 50 51 52 53 |
# File 'lib/docgenerator/standard.rb', line 47 def to_doc(target, = {}) o = Docgenerator.set_option_defaults() if self.is_a?(Docgenerator::Element) and ! self.respond_to?(:to_doc) o[:log].error( "Missing to_doc routine for #{self.class}") if o[:log].error? end self.respond_to?(:to_str) ? self.to_str : self.to_s end |
#to_html(options = {}) ⇒ Object
Extend each object with #to_html
61 |
# File 'lib/docgenerator/standard.rb', line 61 def to_html( = {}); to_doc(:html, ); end |
#to_latex(options = {}) ⇒ Object
Extend each object with #to_latex
57 |
# File 'lib/docgenerator/standard.rb', line 57 def to_latex( = {}); to_doc(:latex, ); end |
#to_text(options = {}) ⇒ Object
Extend each object with #to_text
55 |
# File 'lib/docgenerator/standard.rb', line 55 def to_text( = {}); to_doc(:text, ); end |
#to_wiki(options = {}) ⇒ Object
Extend each object with #to_wiki
63 |
# File 'lib/docgenerator/standard.rb', line 63 def to_wiki( = {}); to_doc(:wiki, ); end |