class ArticleJSON::Elements::Base
Attributes
type[R]
Public Class Methods
parse_hash(hash)
click to toggle source
Create an element from a hash, based on the :type field @param [Hash] hash @return [ArticleJSON::Elements::Base]
# File lib/article_json/elements/base.rb, line 10 def parse_hash(hash) klass = element_classes[hash[:type].to_sym] klass.parse_hash(hash) unless klass.nil? end
Private Class Methods
element_classes()
click to toggle source
# File lib/article_json/elements/base.rb, line 24 def element_classes { embed: Embed, heading: Heading, image: Image, list: List, paragraph: Paragraph, quote: Quote, text: Text, text_box: TextBox, } end