module Bluepine::Attributes

Attributes registry holds the references to all attributes

@see .create

Constants

ALL
KeyError
NATIVE_TYPES
NON_SCALAR_TYPES
SCALAR_TYPES

Attributes

registry[RW]

Holds reference to all attribute objects

@return [Registry]

Private Class Methods

create(type, name, options = {}, &block) click to toggle source

Creates new attribute (Delegates to Registry#create).

@return [Attribute]

@example Creates primitive attribute

Attributes.create(:string, :username, required: true)

@example Creates compound attribute

Attributes.create(:object, :user) do
  string :username
end
# File lib/bluepine/attributes.rb, line 52
def create(type, name, options = {}, &block)
  registry.create(type, name, options, &block)
end
key?(key) click to toggle source
# File lib/bluepine/attributes.rb, line 64
def key?(key)
  registry.key?(key)
end
register(type, klass, override: false) click to toggle source

Registers new Attribute (alias for Registry#register)

@example

register(:custom, CustomAttribute)
# File lib/bluepine/attributes.rb, line 60
def register(type, klass, override: false)
  registry.register(type, klass, override: override)
end