Class: Otter::Base

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

Direct Known Subclasses

Author, Count, Link, Post, Post::Target, Tag, Topic, Trackback, UrlInfo

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data) ⇒ Base

Returns a new instance of Base.



14
15
16
# File 'lib/otter/base.rb', line 14

def initialize(data)
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/otter/base.rb', line 4

def data
  @data
end

Class Method Details

.create(data) ⇒ Object



6
7
8
9
10
11
12
# File 'lib/otter/base.rb', line 6

def self.create(data)
  if data['list'].is_a?(Array)
    data['list'].map { |d| self.new(d) }
  else
    self.new(data)
  end
end