Class: MarkupExtensions::MString

Inherits:
String
  • Object
show all
Includes:
MarkupExtensionMethods
Defined in:
lib/markup_extensions.rb

Instance Method Summary collapse

Methods included from MarkupExtensionMethods

#ahttp, #checklist, #logo

Methods inherited from String

#to_xml

Instance Method Details

#run_methods(methods) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/markup_extensions.rb', line 8

def run_methods(methods) 
  (methods == :all ?
    MarkupExtensionMethods.instance_methods :
    methods
  ).inject(self) { |mstring, meth|
    if mstring.respond_to? meth
      MString.new(mstring.send(meth))
    else
      raise ActsAsMarkup::UnknownExtensionMethod,
       "Extension method \"#{meth.to_s}\" is not defined " 
      MString.new(mstring)
    end
    }
end