lib/roda/endpoints/endpoint/class_interface.rb in roda-endpoints-0.3.3 vs lib/roda/endpoints/endpoint/class_interface.rb in roda-endpoints-0.3.4

- old
+ new

@@ -45,11 +45,13 @@ @ns ||= name.gsub(/^Roda::Endpoints::/, '').underscore.tr('/', '.') end # @return [Symbol] def type - @type ||= Inflecto.underscore(Inflecto.demodulize(name)).to_sym + @type ||= Inflecto.underscore(Inflecto.demodulize( + name || superclass.name + )).to_sym end # @param [Symbol] verb # @param [Proc] block # @return [Symbol] name of the defined method @@ -66,10 +68,10 @@ end end end define_method(verb, &block) key = "operations.#{type}.#{verb}" - container.register key, block + container.register key, block unless container.key? key end # @param [String, Symbol] key # @param [Proc] block #