Sha256: bb33a1d156af8d2747a576dc4a1c7c552ec72cda59417f9df69a55e11c08bc74

Contents?: true

Size: 411 Bytes

Versions: 5

Compression:

Stored size: 411 Bytes

Contents

require 'active_model/naming'

module Rod
  module Rest
    module Naming
      def plural_resource_name(resource)
        singular_resource_name(resource).pluralize
      end

      def singular_resource_name(resource)
        if resource.respond_to?(:name)
          name = resource.name
        else
          name = resource.to_s
        end
        name.gsub("::","_").downcase
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
rod-rest-0.5.2 lib/rod/rest/naming.rb
rod-rest-0.5.1 lib/rod/rest/naming.rb
rod-rest-0.5.0 lib/rod/rest/naming.rb
rod-rest-0.0.1.1 lib/rod/rest/naming.rb
rod-rest-0.0.1 lib/rod/rest/naming.rb