Class: Gottani::Core
- Inherits:
-
Object
- Object
- Gottani::Core
- Defined in:
- lib/gottani_core.rb
Overview
Gottani::Core
Constant Summary collapse
- FORMAT =
{ tab: Gottani::Tab, space2: Gottani::Space2, space4: Gottani::Space4, markdown: Gottani::Markdown, hatena: Gottani::Hatena }
Instance Attribute Summary collapse
-
#common ⇒ Object
readonly
Returns the value of attribute common.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type, base) ⇒ Core
constructor
A new instance of Core.
- #method_missing(method_name, *args, &block) ⇒ Object
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, *args, &block) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/gottani_core.rb', line 26 def method_missing(method_name, *args, &block) method_name.match(/^to_(.*)$/) super unless Regexp.last_match[1] instance = FORMAT[Regexp.last_match[1].to_sym].new return instance.send("to_#{Regexp.last_match[1]}", @common) if instance super end |
Instance Attribute Details
#common ⇒ Object (readonly)
Returns the value of attribute common.
12 13 14 |
# File 'lib/gottani_core.rb', line 12 def common @common end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
12 13 14 |
# File 'lib/gottani_core.rb', line 12 def type @type end |