Class: Zermelo::Records::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/zermelo/records/key.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(opts = {}) ⇒ Key

TODO better validation of data, e.g. accessor valid for type, etc.



14
15
16
17
18
# File 'lib/zermelo/records/key.rb', line 14

def initialize(opts = {})
  [:klass, :id, :name, :accessor, :type, :object].each do |iv|
    instance_variable_set("@#{iv}", opts[iv])
  end
end

Instance Attribute Details

#accessorObject (readonly)

id / if nil, it’s a class variable object / :association, :attribute or :index accessor / if a complex type, some way of getting sub-value



9
10
11
# File 'lib/zermelo/records/key.rb', line 9

def accessor
  @accessor
end

#idObject

Returns the value of attribute id.



11
12
13
# File 'lib/zermelo/records/key.rb', line 11

def id
  @id
end

#klassObject (readonly)

id / if nil, it’s a class variable object / :association, :attribute or :index accessor / if a complex type, some way of getting sub-value



9
10
11
# File 'lib/zermelo/records/key.rb', line 9

def klass
  @klass
end

#nameObject (readonly)

id / if nil, it’s a class variable object / :association, :attribute or :index accessor / if a complex type, some way of getting sub-value



9
10
11
# File 'lib/zermelo/records/key.rb', line 9

def name
  @name
end

#objectObject (readonly)

id / if nil, it’s a class variable object / :association, :attribute or :index accessor / if a complex type, some way of getting sub-value



9
10
11
# File 'lib/zermelo/records/key.rb', line 9

def object
  @object
end

#typeObject (readonly)

id / if nil, it’s a class variable object / :association, :attribute or :index accessor / if a complex type, some way of getting sub-value



9
10
11
# File 'lib/zermelo/records/key.rb', line 9

def type
  @type
end