lib/haveapi/go_client/resource.rb in haveapi-go-client-0.15.1 vs lib/haveapi/go_client/resource.rb in haveapi-go-client-0.16.0
- old
+ new
@@ -42,14 +42,16 @@
@prefix = prefix
@full_name = resource_path.map(&:name).join('_')
@full_dot_name = resource_path.map(&:name).map(&:capitalize).join('.')
@go_name = camelize(name)
@go_type = full_go_type
- @resources = desc[:resources].map { |k, v| Resource.new(self, k, v) }
+ @resources = desc[:resources].map do |k, v|
+ Resource.new(self, k, v)
+ end.sort!
@actions = desc[:actions].map do |k, v|
Action.new(self, k.to_s, v, prefix: prefix)
- end
+ end.sort!
end
# @return [ApiVersion]
def api_version
tmp = parent
@@ -100,9 +102,13 @@
action: a,
},
File.join(gen.dst, prefix_underscore("resource_#{full_name}_action_#{a.name}.go"))
)
end
+ end
+
+ def <=>(other)
+ go_name <=> other.go_name
end
protected
attr_reader :prefix