Class: Shinybooru::Post

Inherits:
Object
  • Object
show all
Defined in:
lib/shinybooru.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nokogiri_data) ⇒ Post

Returns a new instance of Post.



77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/shinybooru.rb', line 77

def initialize (nokogiri_data)
  @data = Hash.new
  nokogiri_data.attribute_nodes.each do |node|
    unless node.name == "tags"
      @data[node.name.to_sym] = node.value
    end
    if node.name == "tags" # so the tags are a list
      @data[node.name.to_sym] = node.value.split " "
    end
    data
  end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



76
77
78
# File 'lib/shinybooru.rb', line 76

def data
  @data
end