class ArticleJSON::Elements::TextBox
Attributes
content[R]
float[R]
Public Class Methods
new(content:, float: nil, tags: [])
click to toggle source
@param [Array] content @param [Symbol] float @param [Array] tags
# File lib/article_json/elements/text_box.rb, line 9 def initialize(content:, float: nil, tags: []) @type = :text_box @content = content @float = float @tags = tags end
parse_hash(hash)
click to toggle source
Create a text box element from Hash @return [ArticleJSON::Elements::TextBox]
# File lib/article_json/elements/text_box.rb, line 30 def parse_hash(hash) new( content: parse_hash_list(hash[:content]), float: hash[:float]&.to_sym, tags: hash[:tags] ) end
Public Instance Methods
to_h()
click to toggle source
Hash representation of this text box element @return [Hash]
# File lib/article_json/elements/text_box.rb, line 18 def to_h { type: type, float: float, content: content.map(&:to_h), tags: tags, } end