Class: Thorwald::Exporter
- Inherits:
-
Object
- Object
- Thorwald::Exporter
- Includes:
- SafeAttributeAssignment
- Defined in:
- lib/thorwald/exporter.rb
Instance Attribute Summary collapse
-
#attribute ⇒ Object
writeonly
Sets the attribute attribute.
-
#clazz ⇒ Object
readonly
Returns the value of attribute clazz.
-
#includes ⇒ Object
Returns the value of attribute includes.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#type ⇒ Object
writeonly
Sets the attribute type.
Instance Method Summary collapse
- #as_json(*args) ⇒ Object
-
#initialize(clazz, params, options = {}) ⇒ Exporter
constructor
A new instance of Exporter.
Constructor Details
#initialize(clazz, params, options = {}) ⇒ Exporter
Returns a new instance of Exporter.
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/thorwald/exporter.rb', line 9 def initialize(clazz, params, = {}) @clazz = clazz @params = params = { includes: [], attribute: :id }.merge() assign_attributes() end |
Instance Attribute Details
#attribute=(value) ⇒ Object
Sets the attribute attribute
7 8 9 |
# File 'lib/thorwald/exporter.rb', line 7 def attribute=(value) @attribute = value end |
#clazz ⇒ Object (readonly)
Returns the value of attribute clazz.
6 7 8 |
# File 'lib/thorwald/exporter.rb', line 6 def clazz @clazz end |
#includes ⇒ Object
Returns the value of attribute includes.
7 8 9 |
# File 'lib/thorwald/exporter.rb', line 7 def includes @includes end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
6 7 8 |
# File 'lib/thorwald/exporter.rb', line 6 def params @params end |
#type=(value) ⇒ Object
Sets the attribute type
7 8 9 |
# File 'lib/thorwald/exporter.rb', line 7 def type=(value) @type = value end |
Instance Method Details
#as_json(*args) ⇒ Object
21 22 23 |
# File 'lib/thorwald/exporter.rb', line 21 def as_json(*args) export.as_json(include: includes) end |