class ActiveLdap::GetText::Parser

Public Class Methods

new(configuration=nil) click to toggle source
# File lib/active_ldap/get_text/parser.rb, line 9
def initialize(configuration=nil)
  configuration = ensure_configuration(configuration)
  configuration = default_configuration.merge(configuration)

  configuration = extract_options(configuration)
  ActiveLdap::Base.setup_connection(configuration)
end

Public Instance Methods

extract_all_in_schema(targets=[]) click to toggle source
# File lib/active_ldap/get_text/parser.rb, line 37
def extract_all_in_schema(targets=[])
  extract(targets) do
    schema = ActiveLdap::Base.schema
    schema.object_classes.each do |object_class|
      register_object_class(object_class, "-")
    end
    schema.attributes.each do |attribute|
      register_attribute(attribute, "-")
    end
    schema.ldap_syntaxes.each do |syntax|
      register_syntax(syntax, "-")
    end
  end
end
parse(file, targets=[]) click to toggle source
# File lib/active_ldap/get_text/parser.rb, line 17
def parse(file, targets=[])
  targets = RubyParser.parse(file, targets) if RubyParser.target?(file)
  extract(targets) do
    load_constants(file).each do |name|
      klass = name.constantize
      next unless klass.is_a?(Class)
      next unless klass < ActiveLdap::Base
      register(klass.name.singularize.underscore.gsub(%r_/, " "), file)
      next unless @extract_schema
      klass.classes.each do |object_class|
        register_object_class(object_class, file)
      end
    end
  end
end
target?(file) click to toggle source
# File lib/active_ldap/get_text/parser.rb, line 33
def target?(file)
  @classes_re.match(File.read(file))
end