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.



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

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



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

def type
  @type
end