Class: Muesli::Serializers::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/muesli/serializers/base.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Base

Returns a new instance of Base.



10
11
12
# File 'lib/muesli/serializers/base.rb', line 10

def initialize(model)
  self.model = model
end

Class Attribute Details

.whitelisted_attributesObject

Returns the value of attribute whitelisted_attributes.



5
6
7
# File 'lib/muesli/serializers/base.rb', line 5

def whitelisted_attributes
  @whitelisted_attributes
end

Instance Attribute Details

#modelObject

Returns the value of attribute model.



8
9
10
# File 'lib/muesli/serializers/base.rb', line 8

def model
  @model
end

#userObject

Returns the value of attribute user.



8
9
10
# File 'lib/muesli/serializers/base.rb', line 8

def user
  @user
end

Instance Method Details

#serializeObject



14
15
16
# File 'lib/muesli/serializers/base.rb', line 14

def serialize
  return serialize_from_model(self.class.whitelisted_attributes || [])
end