Class: SerializationContext

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(context, scope) ⇒ SerializationContext

Returns a new instance of SerializationContext.



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

def initialize(context, scope)
  @context = context
  @scope = scope
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



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

def context
  @context
end

#scopeObject

Returns the value of attribute scope.



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

def scope
  @scope
end

Class Method Details

.create(options) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/panko/serializer.rb', line 14

def self.create(options)
  if options.key?(:context) || options.key?(:scope)
    SerializationContext.new(options[:context], options[:scope])
  else
    EmptySerializerContext.new
  end
end