Module: ActiveLdap::HumanReadable::ClassMethods

### Home Classes Methods

### In Files

- lib/active_ldap/human_readable.rb

### Methods

- #human_attribute_description
- #human_attribute_description_msgid
- #human_attribute_name
- #human_attribute_name_msgid
- #human_object_class_description
- #human_object_class_description_msgid
- #human_object_class_name
- #human_object_class_name_msgid
- #human_readable_format
- #human_syntax_description
- #human_syntax_description_msgid
- #human_syntax_name
- #human_syntax_name_msgid

### Files

- USAGE

### Class/Module Index

Quicksearch

- ActiveLdap
- ActiveLdap::ActionController
- ActiveLdap::ActionController::LdapBenchmarking
- ActiveLdap::Acts
- ActiveLdap::Acts::Tree
- ActiveLdap::Acts::Tree::ClassMethods
- ActiveLdap::Adapter
- ActiveLdap::Adapter::Base
- ActiveLdap::Adapter::Jndi
- ActiveLdap::Adapter::JndiConnection
- ActiveLdap::Adapter::JndiConnection::ModifyRecord
- ActiveLdap::Adapter::JndiConnection::Scope
- ActiveLdap::Adapter::Ldap
- ActiveLdap::Adapter::Ldap::Method
- ActiveLdap::Adapter::Ldap::Method::Base
- ActiveLdap::Adapter::Ldap::Method::Plain
- ActiveLdap::Adapter::Ldap::Method::SSL
- ActiveLdap::Adapter::Ldap::Method::TLS
- ActiveLdap::Adapter::NetLdap
- ActiveLdap::Association
- ActiveLdap::Association::BelongsTo
- ActiveLdap::Association::BelongsToMany
- ActiveLdap::Association::Children
- ActiveLdap::Association::Collection
- ActiveLdap::Association::HasMany
- ActiveLdap::Association::HasManyUtils
- ActiveLdap::Association::HasManyWrap
- ActiveLdap::Association::Proxy
- ActiveLdap::Associations
- ActiveLdap::Associations::ClassMethods
- ActiveLdap::AttributeMethods
- ActiveLdap::AttributeMethods::BeforeTypeCast
- ActiveLdap::AttributeMethods::Dirty
- ActiveLdap::AttributeMethods::Query
- ActiveLdap::AttributeMethods::Read
- ActiveLdap::AttributeMethods::Write
- ActiveLdap::Attributes
- ActiveLdap::Attributes::ClassMethods
- ActiveLdap::Attributes::Normalizable
- ActiveLdap::Callbacks
- ActiveLdap::Callbacks::ClassMethods
- ActiveLdap::Command
- ActiveLdap::Compatible
- ActiveLdap::Configuration
- ActiveLdap::Configuration::ClassMethods
- ActiveLdap::Connection
- ActiveLdap::Connection::ClassMethods
- ActiveLdap::DN
- ActiveLdap::DistinguishedName
- ActiveLdap::DistinguishedName::Parser
- ActiveLdap::EntryAttribute
- ActiveLdap::Escape
- ActiveLdap::Generators
- ActiveLdap::Generators::ModelGenerator
- ActiveLdap::Generators::ScaffoldGenerator
- ActiveLdap::GetText
- ActiveLdap::GetText::Parser
- ActiveLdap::GetTextSupport
- ActiveLdap::Helper
- ActiveLdap::HumanReadable
- ActiveLdap::HumanReadable::ClassMethods
- ActiveLdap::LDIF
- ActiveLdap::LdapError
- ActiveLdap::Ldif
- ActiveLdap::Ldif::AddRecord
- ActiveLdap::Ldif::Attribute
- ActiveLdap::Ldif::Attributes
- ActiveLdap::Ldif::ChangeRecord
- ActiveLdap::Ldif::ChangeRecord::Control
- ActiveLdap::Ldif::ContentRecord
- ActiveLdap::Ldif::DeleteRecord
- ActiveLdap::Ldif::ModifyDNRecord
- ActiveLdap::Ldif::ModifyNameRecord
- ActiveLdap::Ldif::ModifyRDNRecord
- ActiveLdap::Ldif::ModifyRecord
- ActiveLdap::Ldif::ModifyRecord::AddOperation
- ActiveLdap::Ldif::ModifyRecord::DeleteOperation
- ActiveLdap::Ldif::ModifyRecord::Operation
- ActiveLdap::Ldif::ModifyRecord::ReplaceOperation
- ActiveLdap::Ldif::Parser
- ActiveLdap::Ldif::Record
- ActiveLdap::Ldif::Scanner
- ActiveLdap::LogSubscriber
- ActiveLdap::ObjectClass
- ActiveLdap::ObjectClass::ClassMethods
- ActiveLdap::Operations
- ActiveLdap::Operations::ClassOnlyDelete
- ActiveLdap::Operations::ClassOnlyUpdate
- ActiveLdap::Operations::Common
- ActiveLdap::Operations::Delete
- ActiveLdap::Operations::Find
- ActiveLdap::Operations::LDIF
- ActiveLdap::Operations::LDIF::AddRecordLoadable
- ActiveLdap::Operations::LDIF::ContentRecordLoadable
- ActiveLdap::Operations::LDIF::DeleteRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyNameRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::AddOperationModifiable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::DeleteOperationModifiable
- ActiveLdap::Operations::LDIF::ModifyRecordLoadable::ReplaceOperationModifiable
- ActiveLdap::Operations::Update
- ActiveLdap::Persistence
- ActiveLdap::Populate
- ActiveLdap::Railtie
- ActiveLdap::Railties
- ActiveLdap::Railties::ControllerRuntime
- ActiveLdap::Railties::ControllerRuntime::ClassMethods
- ActiveLdap::Schema
- ActiveLdap::Schema::Attribute
- ActiveLdap::Schema::Entry
- ActiveLdap::Schema::ObjectClass
- ActiveLdap::Schema::Syntax
- ActiveLdap::Schema::Syntaxes
- ActiveLdap::Schema::Syntaxes::Base
- ActiveLdap::Schema::Syntaxes::BitString
- ActiveLdap::Schema::Syntaxes::Boolean
- ActiveLdap::Schema::Syntaxes::CountryString
- ActiveLdap::Schema::Syntaxes::DirectoryString
- ActiveLdap::Schema::Syntaxes::DistinguishedName
- ActiveLdap::Schema::Syntaxes::GeneralizedTime
- ActiveLdap::Schema::Syntaxes::Integer
- ActiveLdap::Schema::Syntaxes::JPEG
- ActiveLdap::Schema::Syntaxes::NameAndOptionalUID
- ActiveLdap::Schema::Syntaxes::NumericString
- ActiveLdap::Schema::Syntaxes::OID
- ActiveLdap::Schema::Syntaxes::OtherMailbox
- ActiveLdap::Schema::Syntaxes::PostalAddress
- ActiveLdap::Schema::Syntaxes::PrintableString
- ActiveLdap::Schema::Syntaxes::TelephoneNumber
- ActiveLdap::UserPassword
- ActiveLdap::UserPassword::Salt
- ActiveLdap::Validations
- ActiveLdap::XML
- ActiveLdap::Xml
- ActiveLdap::Xml::Serializer
- LDAP
- LDAP::Conn
- LDAP::Mod
- Net
- Net::LDAP
- Net::LDAP::Entry
- ActionView
- ActionView::Base
- URI
- URI::LDAPS
- Object
- Timeout

No matching classes.

# ActiveLdap::HumanReadable::ClassMethods

### Public Instance Methods

human_attribute_description(attribute_or_name) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 32
    def human_attribute_description(attribute_or_name)
      msgid = human_attribute_description_msgid(attribute_or_name)
      return nil if msgid.nil?
      s_(msgid)
    end

human_attribute_description_msgid(attribute_or_name) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 38
    def human_attribute_description_msgid(attribute_or_name)
      if attribute_or_name.is_a?(Schema::Attribute)
        attribute = attribute_or_name
      else
        attribute = schema.attribute(attribute_or_name.to_s)
        return nil if attribute.nil?
      end
      description = attribute.description
      return nil if description.nil?
      "LDAP|Description|Attribute|#{attribute.name}|#{description}"
    end

human_attribute_name(attribute_or_name, options={}) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 9
    def human_attribute_name(attribute_or_name, options={})
      logger.warn("options was ignored.") unless options.empty?
      msgid = human_attribute_name_msgid(attribute_or_name)
      msgid ||= human_attribute_name_with_gettext(attribute_or_name)
      s_(msgid)
    end

human_attribute_name_msgid(attribute_or_name) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 16
    def human_attribute_name_msgid(attribute_or_name)
      if attribute_or_name.is_a?(Schema::Attribute)
        name = attribute_or_name.name
      else
        attribute = schema.attribute(attribute_or_name.to_s)
        return nil if attribute.id.nil?
        if attribute.name == attribute_or_name or
            attribute.aliases.include?(attribute_or_name.to_s)
          name = attribute_or_name
        else
          return nil
        end
      end
      "LDAP|Attribute|#{name}"
    end

human_object_class_description(object_class_or_name) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 63
    def human_object_class_description(object_class_or_name)
      msgid = human_object_class_description_msgid(object_class_or_name)
      return nil if msgid.nil?
      s_(msgid)
    end

human_object_class_description_msgid(object_class_or_name) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 69
    def human_object_class_description_msgid(object_class_or_name)
      if object_class_or_name.is_a?(Schema::ObjectClass)
        object_class = object_class_or_name
      else
        object_class = schema.object_class(object_class_or_name)
        return nil if object_class.nil?
      end
      description = object_class.description
      return nil if description.nil?
      "LDAP|Description|ObjectClass|#{object_class.name}|#{description}"
    end

human_object_class_name(object_class_or_name) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 50
    def human_object_class_name(object_class_or_name)
      s_(human_object_class_name_msgid(object_class_or_name))
    end

human_object_class_name_msgid(object_class_or_name) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 54
    def human_object_class_name_msgid(object_class_or_name)
      if object_class_or_name.is_a?(Schema::ObjectClass)
        name = object_class_or_name.name
      else
        name = object_class_or_name
      end
      "LDAP|ObjectClass|#{name}"
    end

human_readable_format(object) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 112
    def human_readable_format(object)
      case object
      when Array
        "[#{object.collect {|value| human_readable_format(value)}.join(', ')}]"
      when Hash
        formatted_values = []
        object.each do |key, value|
          formatted_values << [human_readable_format(key),
                               human_readable_format(value)].join("=>")
        end
        "{#{formatted_values.join(', ')}}"
      else
        if object.respond_to?(:to_human_readable_format)
          object.to_human_readable_format
        else
          object.inspect
        end
      end
    end

human_syntax_description(syntax_or_id) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 94
    def human_syntax_description(syntax_or_id)
      msgid = human_syntax_description_msgid(syntax_or_id)
      return nil if msgid.nil?
      s_(msgid)
    end

human_syntax_description_msgid(syntax_or_id) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 100
    def human_syntax_description_msgid(syntax_or_id)
      if syntax_or_id.is_a?(Schema::Syntax)
        syntax = syntax_or_id
      else
        syntax = schema.ldap_syntax(syntax_or_id)
        return nil if syntax.nil?
      end
      description = syntax.description
      return nil if description.nil?
      "LDAP|Description|Syntax|#{syntax.id}|#{description}"
    end

human_syntax_name(syntax_or_id) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 81
    def human_syntax_name(syntax_or_id)
      s_(human_syntax_name_msgid(syntax_or_id))
    end

human_syntax_name_msgid(syntax_or_id) click to toggle source

    # File lib/active_ldap/human_readable.rb, line 85
    def human_syntax_name_msgid(syntax_or_id)
      if syntax_or_id.is_a?(Schema::Syntax)
        id = syntax_or_id.id
      else
        id = syntax_or_id
      end
      "LDAP|Syntax|#{id}"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.