lib/travis/client/entity.rb in travis-1.5.6.travis.297.4 vs lib/travis/client/entity.rb in travis-1.5.6.travis.299.4
- old
+ new
@@ -16,11 +16,11 @@
def self.subclasses
MAP.values.uniq
end
def self.subclass_for(key)
- MAP.fetch(key)
+ MAP.fetch(key.to_s)
end
def self.aka(*names)
names.each { |n| MAP[n.to_s] = self }
end
@@ -70,9 +70,20 @@
end
def self.cast_id(id)
Integer(id)
end
+
+ def self.id?(object)
+ object.is_a? Integer
+ end
+
+ def self.id_field(key = nil)
+ @id_field = key.to_s if key
+ @id_field || superclass.id_field
+ end
+
+ id_field :id
def initialize(session, id)
@attributes = {}
@session = session
@id = self.class.cast_id(id)