Class: Shinybooru::Post

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

Overview

Used internally

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(nokogiri_data) ⇒ Post

Returns a new instance of Post.



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/shinybooru.rb', line 87

def initialize(nokogiri_data)
  @data = {}
  nokogiri_data.attribute_nodes.each do |node|
    @data[node.name.to_sym] = if node.name == 'tags'
                                # so that the tags are a list
                                node.value.split ' '
                              else
                                node.value
                              end
    data
  end
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



86
87
88
# File 'lib/shinybooru.rb', line 86

def data
  @data
end