Method: ArticleJSON::Article.from_hash

Defined in:
lib/article_json/article.rb

.from_hash(hash) ⇒ ArticleJSON::Article

Build a new article from hash (like the one generated by #to_h)



123
124
125
126
# File 'lib/article_json/article.rb', line 123

def from_hash(hash)
  hash = { content: hash } if hash.is_a?(Array)
  new(ArticleJSON::Elements::Base.parse_hash_list(hash[:content]))
end