Class: RiceBubble::Attributes::Serialized

Inherits:
Base
  • Object
show all
Defined in:
lib/rice_bubble/attributes/serialized.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Base

#description, #fetch, #optional, #valid_types

Constructor Details

#initialize(serializer) ⇒ Serialized

Returns a new instance of Serialized.



6
7
8
9
# File 'lib/rice_bubble/attributes/serialized.rb', line 6

def initialize(serializer, &)
  super(&)
  @serializer = serializer
end

Instance Attribute Details

#serializerObject (readonly)

Returns the value of attribute serializer.



4
5
6
# File 'lib/rice_bubble/attributes/serialized.rb', line 4

def serializer
  @serializer
end

Instance Method Details

#call(value, path: '') ⇒ Object



15
16
17
# File 'lib/rice_bubble/attributes/serialized.rb', line 15

def call(value, path: '')
  serializer.call(value, path:)
end

#valid?(value) ⇒ Boolean

Returns:



11
12
13
# File 'lib/rice_bubble/attributes/serialized.rb', line 11

def valid?(value)
  serializer.valid?(value)
end