Class: ActiveRecord::ConnectionAdapters::SalesforceColumn
- Inherits:
-
Column
- Object
- Column
- ActiveRecord::ConnectionAdapters::SalesforceColumn
- Includes:
- StringHelper
- Defined in:
- lib/column_definition.rb
Instance Attribute Summary collapse
-
#api_name ⇒ Object
readonly
Returns the value of attribute api_name.
-
#createable ⇒ Object
readonly
Returns the value of attribute createable.
-
#custom ⇒ Object
readonly
Returns the value of attribute custom.
-
#label ⇒ Object
readonly
Returns the value of attribute label.
-
#reference_to ⇒ Object
readonly
Returns the value of attribute reference_to.
-
#updateable ⇒ Object
readonly
Returns the value of attribute updateable.
Instance Method Summary collapse
- #get_type(field_type) ⇒ Object
- #human_name ⇒ Object
-
#initialize(field) ⇒ SalesforceColumn
constructor
A new instance of SalesforceColumn.
- #is_name? ⇒ Boolean
Methods included from StringHelper
Constructor Details
#initialize(field) ⇒ SalesforceColumn
Returns a new instance of SalesforceColumn.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/column_definition.rb', line 35 def initialize(field) @api_name = field[:name] @custom = field[:custom] == "true" @name = column_nameize(@api_name) @type = get_type(field[:type]) @limit = field[:length] @label = field[:label] @name_field = field[:nameField] == "true" @text = [:string, :text].include? @type @number = [:float, :integer].include? @type @createable = field[:createable] == "true" @updateable = field[:updateable] == "true" if field[:type] =~ /reference/i @reference_to = field[:referenceTo] @one_to_many = false @cascade_delete = false @name = @name.chop.chop << "id__c" if @custom end end |
Instance Attribute Details
#api_name ⇒ Object (readonly)
Returns the value of attribute api_name.
33 34 35 |
# File 'lib/column_definition.rb', line 33 def api_name @api_name end |
#createable ⇒ Object (readonly)
Returns the value of attribute createable.
33 34 35 |
# File 'lib/column_definition.rb', line 33 def createable @createable end |
#custom ⇒ Object (readonly)
Returns the value of attribute custom.
33 34 35 |
# File 'lib/column_definition.rb', line 33 def custom @custom end |
#label ⇒ Object (readonly)
Returns the value of attribute label.
33 34 35 |
# File 'lib/column_definition.rb', line 33 def label @label end |
#reference_to ⇒ Object (readonly)
Returns the value of attribute reference_to.
33 34 35 |
# File 'lib/column_definition.rb', line 33 def reference_to @reference_to end |
#updateable ⇒ Object (readonly)
Returns the value of attribute updateable.
33 34 35 |
# File 'lib/column_definition.rb', line 33 def updateable @updateable end |
Instance Method Details
#get_type(field_type) ⇒ Object
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/column_definition.rb', line 63 def get_type(field_type) case field_type when /int/i :integer when /currency|percent/i :float when /datetime/i :datetime when /date/i :date when /id|string|textarea/i :text when /phone|fax|email|url/i :string when /blob|binary/i :binary when /boolean/i :boolean when /picklist/i :text when /reference/i :text end end |
#human_name ⇒ Object
88 89 90 |
# File 'lib/column_definition.rb', line 88 def human_name @label end |
#is_name? ⇒ Boolean
59 60 61 |
# File 'lib/column_definition.rb', line 59 def is_name? @name_field end |