Class: AlmostHappy::Convertor::Renderer

Inherits:
Struct
  • Object
show all
Defined in:
lib/almost_happy/convertor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



14
15
16
# File 'lib/almost_happy/convertor.rb', line 14

def name
  @name
end

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



14
15
16
# File 'lib/almost_happy/convertor.rb', line 14

def options
  @options
end

#rendererObject

Returns the value of attribute renderer

Returns:

  • (Object)

    the current value of renderer



14
15
16
# File 'lib/almost_happy/convertor.rb', line 14

def renderer
  @renderer
end

Instance Method Details

#[](key) ⇒ Object



16
17
18
# File 'lib/almost_happy/convertor.rb', line 16

def [](key)
  options[key.to_sym]
end

#human_nameObject



24
25
26
# File 'lib/almost_happy/convertor.rb', line 24

def human_name
  ::I18n.t(name, :scope => :"almost_happy.renderers.human_names", :default => name.to_s.humanize)
end

#render(content) ⇒ Object



20
21
22
# File 'lib/almost_happy/convertor.rb', line 20

def render(content)
  renderer.call(content.to_s).to_s.html_safe
end