Module: SchemaTools::Modules::Attributes

Extended by:
ActiveSupport::Concern
Includes:
AsSchema
Defined in:
lib/schema_tools/modules/attributes.rb

Overview

Add schema properties to a class by using has_schema_attrs to define from which schema to inherit attributes.

Examples:


class Contact
  has_schema_attrs :contact
end
Contact.schema_name     #=> contact
Contact.as_schema_json  #=> json string
Contact.as_hash         #=> ruby hash
Contact.schema          #=> json schema hash

Defined Under Namespace

Modules: ClassMethods

Instance Method Summary collapse

Methods included from AsSchema

#as_hash, #as_schema_hash, #as_schema_json

Instance Method Details

#schemaObject



23
24
25
# File 'lib/schema_tools/modules/attributes.rb', line 23

def schema
  self.class.schema
end

#schema_attrsObject



19
20
21
# File 'lib/schema_tools/modules/attributes.rb', line 19

def schema_attrs
  @schema_attrs ||= {}
end