Class: 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.



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

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

Instance Method Details

#extraction_keyObject



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

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

#precondition?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

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

#valueObject

Raises:

  • (NotImplementedError)


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

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