File tree Expand file tree Collapse file tree 3 files changed +6
-6
lines changed
modules/swagger-codegen/src/main/resources/ruby
samples/client/petstore/ruby/lib/petstore/models Expand file tree Collapse file tree 3 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 66 # @param [String] The enum value in the form of the string
77 # @return [String] The enum value
88 def build_from_hash(value)
9- consantValues = { {classname} }.constants.select{ |c| c.to_s == value}
10- raise "Invalid ENUM value #{ value} for class #{ {{classname} }}" if consantValues .empty?
9+ constantValues = { {classname} }.constants.select{ |c| {{classname } }::const_get(c) == value}
10+ raise "Invalid ENUM value #{ value} for class #{ {{classname} }}" if constantValues .empty?
1111 value
1212 end
1313 end
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ class EnumClass
2323 # @param [String] The enum value in the form of the string
2424 # @return [String] The enum value
2525 def build_from_hash ( value )
26- consantValues = EnumClass . constants . select { |c | c . to_s == value }
27- raise "Invalid ENUM value #{ value } for class #EnumClass" if consantValues . empty?
26+ constantValues = EnumClass . constants . select { |c | EnumClass :: const_get ( c ) == value }
27+ raise "Invalid ENUM value #{ value } for class #EnumClass" if constantValues . empty?
2828 value
2929 end
3030 end
Original file line number Diff line number Diff line change @@ -23,8 +23,8 @@ class OuterEnum
2323 # @param [String] The enum value in the form of the string
2424 # @return [String] The enum value
2525 def build_from_hash ( value )
26- consantValues = OuterEnum . constants . select { |c | c . to_s == value }
27- raise "Invalid ENUM value #{ value } for class #OuterEnum" if consantValues . empty?
26+ constantValues = OuterEnum . constants . select { |c | OuterEnum :: const_get ( c ) == value }
27+ raise "Invalid ENUM value #{ value } for class #OuterEnum" if constantValues . empty?
2828 value
2929 end
3030 end
You can’t perform that action at this time.
0 commit comments