Class: Moblues::DataModel::Attribute

Inherits:
Struct
  • Object
show all
Defined in:
lib/moblues/data_model/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(params) ⇒ Attribute

Returns a new instance of Attribute.



6
7
8
9
10
11
12
13
14
15
# File 'lib/moblues/data_model/attribute.rb', line 6

def initialize(params)
  p = params.compact
  optional = false
  optional = p.fetch(:optional) if p.key?(:optional)
  super(
    p.fetch(:name),
    p.fetch(:type),
    optional
  )
end

Instance Attribute Details

#nameObject

Returns the value of attribute name

Returns:

  • the current value of name



5
6
7
# File 'lib/moblues/data_model/attribute.rb', line 5

def name
  @name
end

#optionalObject

Returns the value of attribute optional

Returns:

  • the current value of optional



5
6
7
# File 'lib/moblues/data_model/attribute.rb', line 5

def optional
  @optional
end

#typeObject

Returns the value of attribute type

Returns:

  • the current value of type



5
6
7
# File 'lib/moblues/data_model/attribute.rb', line 5

def type
  @type
end