Class: Azeroth::Model Private

Inherits:
Object
  • Object
show all
Defined in:
lib/azeroth/model.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Model responsible for making the conection to the resource model class

Author:

  • Darthjee

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Model

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Model.

Parameters:

  • name (String, Symbol)

    name of the resource



18
19
20
# File 'lib/azeroth/model.rb', line 18

def initialize(name)
  @name = name.to_s
end

Instance Attribute Details

#nameString (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the name of the resource represented by the model

Returns:

  • (String)


10
11
12
# File 'lib/azeroth/model.rb', line 10

def name
  @name
end

Instance Method Details

#klassClass

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Resource class (real model class)

Returns:

  • (Class)


25
26
27
# File 'lib/azeroth/model.rb', line 25

def klass
  @klass ||= name.camelize.constantize
end

#pluralString

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Return the pluralized version of resource name

Returns:

  • (String)


32
33
34
# File 'lib/azeroth/model.rb', line 32

def plural
  name.pluralize
end