Class: NumeritajTipo::AttributeDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/numeritaj_tipo/attribute_definition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, values: nil, type: Symbol, default: nil, allow_nil: false) ⇒ AttributeDefinition

Returns a new instance of AttributeDefinition.



7
8
9
10
11
12
# File 'lib/numeritaj_tipo/attribute_definition.rb', line 7

def initialize(name, values: nil, type: Symbol, default: nil, allow_nil: false)
  @name = name
  @enum_type = EnumType.new(type, values)
  @default = default
  @allow_nil = allow_nil
end

Instance Attribute Details

#defaultObject (readonly)

Returns the value of attribute default.



3
4
5
# File 'lib/numeritaj_tipo/attribute_definition.rb', line 3

def default
  @default
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/numeritaj_tipo/attribute_definition.rb', line 3

def name
  @name
end

Instance Method Details

#build(target) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/numeritaj_tipo/attribute_definition.rb', line 14

def build(target)
  define_enum! target

  define_helpers! target
  define_predicates! target
  define_scopes! target
end