lib/apipie/response_description_adapter.rb in apipie-rails-0.9.1 vs lib/apipie/response_description_adapter.rb in apipie-rails-0.9.2
- old
+ new
@@ -105,13 +105,14 @@
return self.send(key) if self.respond_to?(key.to_s)
end
def add_sub_property(prop_desc)
raise "Only properties with expected_type 'object' can have sub-properties" unless @expected_type == 'object'
- if prop_desc.is_a? PropDesc
+ case prop_desc
+ when PropDesc
@sub_properties << prop_desc
- elsif prop_desc.is_a? Modifier
+ when Modifier
prop_desc.apply(self)
else
raise "Unrecognized prop_desc type (#{prop_desc.class})"
end
end
@@ -128,11 +129,11 @@
}
end
attr_reader :name, :required, :expected_type, :options, :description
attr_accessor :additional_properties
- alias_method :desc, :description
+ alias desc description
def is_array?
@is_array
end
@@ -168,12 +169,13 @@
def to_json
params_ordered.to_json
end
def add(prop_desc)
- if prop_desc.is_a? PropDesc
+ case prop_desc
+ when PropDesc
@property_descs << prop_desc
- elsif prop_desc.is_a? Modifier
+ when Modifier
prop_desc.apply(self)
else
raise "Unrecognized prop_desc type (#{prop_desc.class})"
end
end