lib/travis/client/entity.rb in travis-1.6.4.travis.411.4 vs lib/travis/client/entity.rb in travis-1.6.4.travis.413.4
- old
+ new
@@ -113,14 +113,20 @@
def attribute_names
self.class.attributes
end
+ def to_h
+ Hash[attribute_names.map { |n| [n, self[n]] }]
+ end
+
def [](key)
+ key = key.to_s
send(key) if include? key
end
def []=(key, value)
+ key = key.to_s
send("#{key}=", value) if include? key
end
def include?(key)
attributes.include? key or attribute_names.include? key.to_s