Class: Azeroth::ResourceBuilder Private
- Inherits:
-
Object
- Object
- Azeroth::ResourceBuilder
- Defined in:
- lib/azeroth/resource_builder.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.
Builder responsible for for building the resource methods
The builder adds 2 methods, one for listing all entries of a resource, and one for fetching an specific entry
Instance Method Summary collapse
-
#append ⇒ Array<Sinclair::MethodDefinition>
private
Append methods to be built to the builder.
-
#initialize(model, builder) ⇒ ResourceBuilder
constructor
private
A new instance of ResourceBuilder.
Constructor Details
#initialize(model, builder) ⇒ ResourceBuilder
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 ResourceBuilder.
15 16 17 18 |
# File 'lib/azeroth/resource_builder.rb', line 15 def initialize(model, builder) @model = model @builder = builder end |
Instance Method Details
#append ⇒ Array<Sinclair::MethodDefinition>
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.
Append methods to be built to the builder
Methods are the listing of all entities and fetching of an specific entity
26 27 28 29 |
# File 'lib/azeroth/resource_builder.rb', line 26 def append add_method(plural, "@#{plural} ||= #{model.klass}.all") add_method(name, "@#{name} ||= #{plural}.find(#{name}_id)") end |