Class: Trax::Model::Attributes::Definitions

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/trax/model/attributes/definitions.rb

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Definitions

Returns a new instance of Definitions.



5
6
7
# File 'lib/trax/model/attributes/definitions.rb', line 5

def initialize(model)
  @model = model
end

Instance Method Details

#__getobj__Object



9
10
11
# File 'lib/trax/model/attributes/definitions.rb', line 9

def __getobj__
  @model
end

#attribute(*args, type:, **options, &block) ⇒ Object



13
14
15
# File 'lib/trax/model/attributes/definitions.rb', line 13

def attribute(*args, type:, **options, &block)
  @model.trax_attribute(*args, type: type, **options, &block)
end

#boolean(*args, **options, &block) ⇒ Object



17
18
19
# File 'lib/trax/model/attributes/definitions.rb', line 17

def boolean(*args, **options, &block)
  attribute(*args, :type => :boolean, **options, &block)
end

#enum(*args, **options, &block) ⇒ Object



21
22
23
# File 'lib/trax/model/attributes/definitions.rb', line 21

def enum(*args, **options, &block)
  attribute(*args, type: :enum, **options, &block)
end

#integer(*args, **options, &block) ⇒ Object



25
26
27
# File 'lib/trax/model/attributes/definitions.rb', line 25

def integer(*args, **options, &block)
  attribute(*args, type: :integer, **options, &block)
end

#string(*args, **options, &block) ⇒ Object



29
30
31
# File 'lib/trax/model/attributes/definitions.rb', line 29

def string(*args, **options, &block)
  attribute(*args, :type => :string, **options, &block)
end

#struct(*args, **options, &block) ⇒ Object



33
34
35
# File 'lib/trax/model/attributes/definitions.rb', line 33

def struct(*args, **options, &block)
  attribute(*args, :type => :json, **options, &block)
end