Class: Hahamut::Attribute::Json

Inherits:
Base
  • Object
show all
Defined in:
lib/hahamut/attribute/json.rb

Overview

JSON Attribute

Instance Attribute Summary

Attributes inherited from Base

#before_cast

Instance Method Summary collapse

Methods inherited from Base

#as_json, #initialize, #to_json

Constructor Details

This class inherits a constructor from Hahamut::Attribute::Base

Instance Method Details

#valueObject



7
8
9
10
11
# File 'lib/hahamut/attribute/json.rb', line 7

def value
  @value ||= before_cast.as_json if before_cast.respond_to?(:as_json)
  @value ||= before_cast if before_cast.is_a?(Hash)
  @value ||= {}
end