Class: Serializer::Value

Inherits:
Object
  • Object
show all
Defined in:
lib/serializer/value.rb

Direct Known Subclasses

HashValue, ObjectValue, SerializedValue, StaticValue

Instance Method Summary collapse

Constructor Details

#initialize(attribute, scope = nil) ⇒ Value

Returns a new instance of Value.



3
4
5
6
# File 'lib/serializer/value.rb', line 3

def initialize(attribute, scope = nil)
  @attribute = attribute
  @scope = scope
end

Instance Method Details

#extraction_keyObject



8
9
10
# File 'lib/serializer/value.rb', line 8

def extraction_key
  @attribute.from || @attribute.key
end

#precondition?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


12
13
14
# File 'lib/serializer/value.rb', line 12

def precondition?
  raise NotImplementedError, 'needs a method called precondition?'
end

#valueObject

Raises:

  • (NotImplementedError)


16
17
18
# File 'lib/serializer/value.rb', line 16

def value
  raise NotImplementedError, 'needs a method called value'
end