Sha256: 7bdcb5f1b39210f03729b85f2e73276be14d72957472e40983dc4eebe87ab63a

Contents?: true

Size: 638 Bytes

Versions: 3

Compression:

Stored size: 638 Bytes

Contents

#:enddoc:
module RailsConnector

  class ObjClass < CmsBaseModel
    def self.by_name(name)
      obj_class_cache[name]
    end

    def self.reset_cache
      @obj_class_cache = nil
    end

    def name
      obj_class_name
    end

    def has_attribute?(name)
      @custom_attribute_names ||= custom_attributes.map(&:name)
      @custom_attribute_names.include?(name.to_s)
    end

    module ClassMethods
      private

      def obj_class_cache
        @obj_class_cache ||= find(:all).each_with_object({}) do |objclass, map|
          map[objclass.name] = objclass
        end
      end
    end

    extend ClassMethods
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
infopark_cloud_connector-6.8.0.beta.200.663.ceecdee lib/rails_connector/obj_class.rb
infopark_cloud_connector-6.8.0.beta.200.650.7c93155 lib/rails_connector/obj_class.rb
infopark_cloud_connector-6.8.0.beta.200.621.4c8e1b0 lib/rails_connector/obj_class.rb