Class: Maruku

Inherits:
Object
  • Object
show all
Includes:
Stringlike
Defined in:
lib/acts_as_markup/exts/maruku.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Stringlike

#method_missing

Constructor Details

#initialize(s = nil, meta = {}) ⇒ Maruku

Returns a new instance of Maruku.



8
9
10
11
12
13
14
15
# File 'lib/acts_as_markup/exts/maruku.rb', line 8

def initialize(s=nil, meta={})
  super(nil)
  self.attributes.merge! meta
  if s
    @text = s
    parse_doc(s)
  end
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stringlike

Instance Attribute Details

#textObject (readonly)

Returns the value of attribute text.



6
7
8
# File 'lib/acts_as_markup/exts/maruku.rb', line 6

def text
  @text
end

Instance Method Details

#blank?Boolean

used to be compatable with Rails/ActiveSupport

Returns:

  • (Boolean)


23
24
25
# File 'lib/acts_as_markup/exts/maruku.rb', line 23

def blank?
  @text.blank?
end

#to_sObject

Used to get the original Markdown text.



18
19
20
# File 'lib/acts_as_markup/exts/maruku.rb', line 18

def to_s
  @text
end