Module: EPlat::Concerns::FullJson

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/e_plat/resource/concerns/full_json.rb

Instance Method Summary collapse

Instance Method Details

#as_full_jsonObject

{}



10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/e_plat/resource/concerns/full_json.rb', line 10

def as_full_json # {}
    self.attributes.each_with_object({}) do |(key, value), result|
        result[key] = 
            case
            when value.is_a?(EPlat::Base)
              value.as_full_json
            when value.is_a?(Array)
              value.map do |v|
                v.is_a?(EPlat::Base) ? v.as_full_json : v
              end
            else
              value
            end
    end
end

#to_full_jsonObject

‘{}’



6
7
8
# File 'lib/e_plat/resource/concerns/full_json.rb', line 6

def to_full_json # '{}'
  as_full_json.to_json
end