Sha256: dbf9aa3f1d32ce27dd08c2606a432d02e381ab4f5f428ff02fd8a86910361a4d

Contents?: true

Size: 735 Bytes

Versions: 11

Compression:

Stored size: 735 Bytes

Contents

require "fiona7/type_register"
require "fiona7/obj_classes_from_cms"
require "fiona7/attribute_name_mangler"

module Fiona7
  class AttributeNamesFromCms
    def initialize(attribute, type_register=Fiona7::TypeRegister.instance)
      @attribute = attribute
      @type_register = type_register
    end

    def attributes
      # Select all known (i.e. registered) classes
      obj_classes = Fiona7::ObjClassesFromCms.new(@type_register).obj_classes
      # Select classes with the given attribute
      obj_classes = obj_classes.select {|obj_class| @type_register.read(obj_class).find_attribute(@attribute) }
      obj_classes.map {|obj_class| Fiona7::AttributeNameMangler.new(@attribute, obj_class).mangle }.uniq
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
infopark_fiona7-1.6.1.1.5 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.6.1.1.1 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.6.1.1.0 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.5.5.5.1 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.5.5.5.0 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.5.5.4.1 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.5.5.4.0 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.5.5.3.1 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.5.4.3.0 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.5.3.2.0 lib/fiona7/attribute_names_from_cms.rb
infopark_fiona7-1.5.3.2.0.pre.beta1 lib/fiona7/attribute_names_from_cms.rb