module ArticleJSON::Export::Common::Elements::Base
Public Class Methods
included(base)
click to toggle source
Extend `base` class with `ClassMethods` upon inclusion
# File lib/article_json/export/common/elements/base.rb, line 7 def self.included(base) base.extend ClassMethods end
new(element)
click to toggle source
@param [ArticleJSON::Elements::Base] element
# File lib/article_json/export/common/elements/base.rb, line 12 def initialize(element) @element = element end
Public Instance Methods
export()
click to toggle source
Export
the given element. Dynamically looks up the right export-element-class, instantiates it and then calls the `#export` method. @return [Object]
# File lib/article_json/export/common/elements/base.rb, line 20 def export exporter.export unless exporter.nil? end
Private Instance Methods
base_class()
click to toggle source
Return the base class for the current element instance @return [ArticleJSON::Export::Common::Elements::Base]
# File lib/article_json/export/common/elements/base.rb, line 35 def base_class self.class.namespace::Base end
exporter()
click to toggle source
Get the right exporter class for the given element @return [ArticleJSON::Export::Common::Elements::Base]
# File lib/article_json/export/common/elements/base.rb, line 28 def exporter @exporter ||= self.class.base_class? ? self.class.build(@element) : self end