Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

data_type should be set on extend().

  • Loading branch information...
commit d8058e97c9f0eac8c5af38c29fb05e8ea0985a59 1 parent 3f6d59c
@knu authored
Showing with 12 additions and 4 deletions.
  1. +12 −4 lib/friendfeed/v2/object.rb
View
16 lib/friendfeed/v2/object.rb
@@ -159,9 +159,7 @@ def parse_as_array_of(mod, *keys)
module DataType
def self.included(mod)
def mod.create(hash, client = nil)
- Object.new(hash, client).extend(self).tap { |object|
- object.data_type = self
- }
+ Object.new(hash, client).extend(self)
end
end
end
@@ -175,6 +173,7 @@ module Feed
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_enum(:type)
object.parse_as_boolean(:private)
object.parse_as_array_of(Entry, :entries)
@@ -192,6 +191,7 @@ module Entry
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_uri(:url, :short_url)
object.parse_as_time(:date)
object.parse_as(Feed, :from)
@@ -223,6 +223,7 @@ module Comment
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_time(:date)
object.parse_as(Feed, :from)
object.parse_as(Via, :via)
@@ -237,6 +238,7 @@ module Thumbnail
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_uri(:url, :link)
end
end
@@ -248,6 +250,7 @@ module File
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_uri(:url, :icon)
end
end
@@ -259,8 +262,8 @@ def self.extended(object)
module Like
include DataType
-
def self.extended(object)
+ object.data_type = self
object.parse_as_time(:date)
object.parse_as(Feed, :from)
object.parse_as_boolean(:created, :updated)
@@ -274,6 +277,7 @@ module Via
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_uri(:url)
end
end
@@ -285,6 +289,7 @@ module FoF
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_enum(:type)
object.parse_as(:Feed, :from)
end
@@ -297,6 +302,7 @@ module Service
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_enum(:id)
object.parse_as_uri(:url, :icon, :profile)
end
@@ -309,6 +315,7 @@ module FeedList
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_array_of(Feed, :main, :lists, :groups, :searches)
object.parse_as_array_of(Section, :sections)
end
@@ -321,6 +328,7 @@ module Section
include DataType
def self.extended(object)
+ object.data_type = self
object.parse_as_enum(:id)
object.parse_as_array_of(Feed, :feeds)
end
Please sign in to comment.
Something went wrong with that request. Please try again.