Module: LaserLemon::DrySerial

Defined in:
lib/dry_serial.rb,
lib/serialization.rb

Defined Under Namespace

Modules: ClassMethods, Serializer, XmlSerializer

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/dry_serial.rb', line 5

def self.included(base)
  base.class_eval do
    extend ClassMethods

    class_inheritable_hash :serialization_options
    self.serialization_options = {}

    class_inheritable_accessor :default_serialization_style
    self.default_serialization_style = nil

    alias_method_chain :to_xml, :breakfast
    alias_method_chain :to_json, :breakfast
  end
end

Instance Method Details

#to_json_with_breakfast(*args) ⇒ Object



47
48
49
50
# File 'lib/dry_serial.rb', line 47

def to_json_with_breakfast(*args)
  options = self.class.styled_serialization_options(*args)
  to_json_without_breakfast(options)
end

#to_xml_with_breakfast(*args, &block) ⇒ Object



42
43
44
45
# File 'lib/dry_serial.rb', line 42

def to_xml_with_breakfast(*args, &block)
  options = self.class.styled_serialization_options(*args)
  to_xml_without_breakfast(options, &block)
end