Sha256: 5c2386e4e31a11a14f837c259ea2d4f262c83d336e68f9be64e5c3d908f3984f

Contents?: true

Size: 720 Bytes

Versions: 2

Compression:

Stored size: 720 Bytes

Contents

# frozen_string_literal: true

module Azeroth
  # @api private
  # @author Darthjee
  #
  # Model responsible for making the conection to the resource model class
  class Model
    attr_reader :name
    # @method name
    # @api private
    #
    # Returns the name of the resource represented by the model
    #
    # @return [String]

    # @param name [String,Symbol] name of the resource
    def initialize(name)
      @name = name.to_s
    end

    # Resource class (real model class)
    #
    # @return [Class]
    def klass
      @klass ||= name.camelize.constantize
    end

    # Return the pluralized version of resource name
    #
    # @return [String]
    def plural
      name.pluralize
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
azeroth-0.0.6 lib/azeroth/model.rb
azeroth-0.0.5 lib/azeroth/model.rb