Class: Bhf::Mongoid::Document::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/bhf/mongoid/document.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mongoid_field) ⇒ Field

Returns a new instance of Field.



10
11
12
13
14
# File 'lib/bhf/mongoid/document.rb', line 10

def initialize(mongoid_field)
  @name = mongoid_field.name
  @type = mongoid_field.type.to_s.downcase.to_sym
  @type = :primary_key if @type == :'bson::objectid'
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/bhf/mongoid/document.rb', line 8

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



8
9
10
# File 'lib/bhf/mongoid/document.rb', line 8

def type
  @type
end