Class: Trestle::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/trestle/attribute.rb

Direct Known Subclasses

Association

Defined Under Namespace

Classes: Association

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, options = {}) ⇒ Attribute

Returns a new instance of Attribute.



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

def initialize(name, type, options={})
  @name, @type, @options = name.to_sym, type, options
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/trestle/attribute.rb', line 3

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



3
4
5
# File 'lib/trestle/attribute.rb', line 3

def options
  @options
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/trestle/attribute.rb', line 3

def type
  @type
end

Instance Method Details

#array?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/trestle/attribute.rb', line 9

def array?
  options[:array] == true
end