Sha256: 30eeee3366a095586df6b4d147f5a40ca3670bc4c7a82c185521d01ff54d822e

Contents?: true

Size: 617 Bytes

Versions: 18

Compression:

Stored size: 617 Bytes

Contents

require 'active_force/standard_types'

module ActiveForce
  class Table

    def initialize klass
      @klass = klass.to_s
    end

    def table_name name = nil
      @name = name || @name || pick_table_name
    end

    def name
      @name ||= pick_table_name
    end

    def custom_table?
      !StandardTypes::STANDARD_TYPES.include?(name_without_namespace)
    end

    private

    def pick_table_name
      if custom_table?
        "#{ name_without_namespace }__c"
      else
        name_without_namespace
      end
    end

    def name_without_namespace
       @klass.split('::').last
    end

  end
end

Version data entries

18 entries across 18 versions & 2 rubygems

Version Path
openstax_active_force-1.1.1 lib/active_force/table.rb
active_force-0.24.0 lib/active_force/table.rb
active_force-0.23.0 lib/active_force/table.rb
active_force-0.22.1 lib/active_force/table.rb
active_force-0.22.0 lib/active_force/table.rb
active_force-0.21.0 lib/active_force/table.rb
active_force-0.20.1 lib/active_force/table.rb
active_force-0.20.0 lib/active_force/table.rb
active_force-0.19.0 lib/active_force/table.rb
active_force-0.18.0 lib/active_force/table.rb
active_force-0.17.0 lib/active_force/table.rb
active_force-0.16.0 lib/active_force/table.rb
active_force-0.15.1 lib/active_force/table.rb
active_force-0.15.0 lib/active_force/table.rb
openstax_active_force-1.1.0 lib/active_force/table.rb
openstax_active_force-1.0.0 lib/active_force/table.rb
active_force-0.7.1 lib/active_force/table.rb
active_force-0.7.0 lib/active_force/table.rb