Class: Seri::Serializer::Value

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

Direct Known Subclasses

HashValue, SerializedValue, StaticValue

Instance Method Summary collapse

Constructor Details

#initialize(attribute, scope = nil) ⇒ Value

Returns a new instance of Value.



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

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

Instance Method Details

#extraction_keyObject



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

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

#precondition?Boolean

Returns:

  • (Boolean)

Raises:

  • (NotImplementedError)


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

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

#valueObject

Raises:

  • (NotImplementedError)


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

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