Class: Gearhead::Actions::Create
- Inherits:
-
Object
- Object
- Gearhead::Actions::Create
- Defined in:
- lib/gearhead/actions/create.rb
Instance Attribute Summary collapse
-
#gear ⇒ Object
readonly
Returns the value of attribute gear.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Class Method Summary collapse
Instance Method Summary collapse
- #build ⇒ Object
-
#initialize(gear, request) ⇒ Create
constructor
A new instance of Create.
Constructor Details
#initialize(gear, request) ⇒ Create
Returns a new instance of Create.
11 12 13 14 15 |
# File 'lib/gearhead/actions/create.rb', line 11 def initialize(gear, request) @gear = gear @request = request @resource = new_resource end |
Instance Attribute Details
#gear ⇒ Object (readonly)
Returns the value of attribute gear.
10 11 12 |
# File 'lib/gearhead/actions/create.rb', line 10 def gear @gear end |
#request ⇒ Object (readonly)
Returns the value of attribute request.
10 11 12 |
# File 'lib/gearhead/actions/create.rb', line 10 def request @request end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
10 11 12 |
# File 'lib/gearhead/actions/create.rb', line 10 def resource @resource end |
Class Method Details
.build(gear, request) ⇒ Object
6 7 8 |
# File 'lib/gearhead/actions/create.rb', line 6 def self.build(gear, request) new(gear, request).build end |
Instance Method Details
#build ⇒ Object
17 18 19 20 21 |
# File 'lib/gearhead/actions/create.rb', line 17 def build params = ParamsBuilder.new(self).for(:create) @resource.assign_attributes(params) @resource end |