Sha256: cce3c2946d9e1a2ed971b5ce9362c35b54175fd52485bba001c316487fd4ffff

Contents?: true

Size: 637 Bytes

Versions: 2

Compression:

Stored size: 637 Bytes

Contents

# frozen_string_literal: true

require 'singleton'
# module Mutils
module Mutils
  module Lib
    # BaseSerializer: inherit this class to get Serializer functionality
    class Helper
      include Singleton

      def initialize
        self.inflector_object = Dry::Inflector.new
      end

      def underscore(string)
        inflector_object.underscore string
      end

      def pluralize(string)
        inflector_object.pluralize string
      end

      def collection?(object)
        object.respond_to?(:size) && !object.respond_to?(:each_pair)
      end

      private

      attr_accessor :inflector_object
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mutils-0.2.37 lib/mutils/lib/helper.rb
mutils-0.2.36 lib/mutils/lib/helper.rb