Class: Sequel::Plugins::JsonSerializer::Literal

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/plugins/json_serializer.rb

Overview

Helper class used for making sure that cascading options for model associations works correctly. Cascaded options work by creating instances of this class, which take a literal JSON string and have to_json return it.

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ Literal

Store the literal JSON to use



86
87
88
# File 'lib/sequel/plugins/json_serializer.rb', line 86

def initialize(json)
  @json = json
end

Instance Method Details

#to_json(*a) ⇒ Object

Return the literal JSON to use



91
92
93
# File 'lib/sequel/plugins/json_serializer.rb', line 91

def to_json(*a)
  @json
end