lib/kilza/property.rb in kilza-1.0.4 vs lib/kilza/property.rb in kilza-1.0.6
- old
+ new
@@ -9,19 +9,23 @@
# Original JSON property name
attr_accessor :original_name
# Ruby string type
# Can be object, fixnum, float, falseclass, trueclass and nilclass
+ attr_accessor :original_type
+
+ # Property type name
attr_accessor :type
# Indicates if the property represents an array of objects
attr_accessor :array
alias_method :array?, :array
# Indicates if the property should be used for comparing purposes
# Used to compare if one object is equal to another one
attr_accessor :key
+ alias_method :key?, :key
def initialize(name, type, array, key)
@name = Kilza.normalize(name)
@original_name = name
@type = type
@@ -46,9 +50,13 @@
@original_type == 'float'
end
def null?
@original_type == 'nilclass'
+ end
+
+ def ==(pr)
+ @name == pr.name
end
def to_s
{
name: @name,