Class: OpenID::Yadis::TransformFilterMaker

### Home Classes Methods

### In Files

- lib/openid/yadis/filters.rb

### Parent

Object

### Methods

- ::new
- #apply_filters
- #get_service_endpoints

### Files

- LICENSE

### Class/Module Index

Quicksearch

- OpenID
- OpenID::AX
- OpenID::AX::AXMessage
- OpenID::AX::AttrInfo
- OpenID::AX::Error
- OpenID::AX::FetchRequest
- OpenID::AX::FetchResponse
- OpenID::AX::KeyValueMessage
- OpenID::AX::StoreRequest
- OpenID::AX::StoreResponse
- OpenID::AssertionError
- OpenID::Association
- OpenID::AssociationNegotiator
- OpenID::Consumer
- OpenID::Consumer::AssociationManager
- OpenID::Consumer::CancelResponse
- OpenID::Consumer::CheckIDRequest
- OpenID::Consumer::DiffieHellmanSHA1Session
- OpenID::Consumer::DiffieHellmanSHA256Session
- OpenID::Consumer::DiffieHellmanSession
- OpenID::Consumer::DiscoveredServices
- OpenID::Consumer::DiscoveryManager
- OpenID::Consumer::FailureResponse
- OpenID::Consumer::IdResHandler
- OpenID::Consumer::NoEncryptionSession
- OpenID::Consumer::Response
- OpenID::Consumer::Session
- OpenID::Consumer::SetupNeededResponse
- OpenID::Consumer::SuccessResponse
- OpenID::CryptUtil
- OpenID::DiffieHellman
- OpenID::DiscoveryFailure
- OpenID::Extension
- OpenID::FetchingError
- OpenID::HTTPRedirectLimitReached
- OpenID::HTTPResponse
- OpenID::HTTPStatusError
- OpenID::InvalidOpenIDNamespace
- OpenID::KVFormError
- OpenID::KVPostNetworkError
- OpenID::Message
- OpenID::Message::KeyNotFound
- OpenID::NamespaceAliasRegistrationError
- OpenID::NamespaceMap
- OpenID::Nonce
- OpenID::OAuth
- OpenID::OAuth::Request
- OpenID::OAuth::Response
- OpenID::OpenIDError
- OpenID::OpenIDServiceEndpoint
- OpenID::PAPE
- OpenID::PAPE::Request
- OpenID::PAPE::Response
- OpenID::ProtocolError
- OpenID::RealmVerificationRedirected
- OpenID::SReg
- OpenID::SReg::NamespaceError
- OpenID::SReg::Request
- OpenID::SReg::Response
- OpenID::SSLFetchingError
- OpenID::Server
- OpenID::Server::AlreadySigned
- OpenID::Server::AssociateRequest
- OpenID::Server::BaseServerSession
- OpenID::Server::CheckAuthRequest
- OpenID::Server::CheckIDRequest
- OpenID::Server::Decoder
- OpenID::Server::DiffieHellmanSHA1ServerSession
- OpenID::Server::DiffieHellmanSHA256ServerSession
- OpenID::Server::Encoder
- OpenID::Server::EncodingError
- OpenID::Server::MalformedReturnURL
- OpenID::Server::MalformedTrustRoot
- OpenID::Server::NoReturnToError
- OpenID::Server::OpenIDRequest
- OpenID::Server::OpenIDResponse
- OpenID::Server::PlainTextServerSession
- OpenID::Server::ProtocolError
- OpenID::Server::Server
- OpenID::Server::Signatory
- OpenID::Server::SigningEncoder
- OpenID::Server::UntrustedReturnURL
- OpenID::Server::VersionError
- OpenID::Server::WebResponse
- OpenID::ServerError
- OpenID::StandardFetcher
- OpenID::Store
- OpenID::Store::Filesystem
- OpenID::Store::Interface
- OpenID::Store::Memcache
- OpenID::Store::Memory
- OpenID::TrustRoot
- OpenID::TrustRoot::TrustRoot
- OpenID::TypeURIMismatch
- OpenID::UI
- OpenID::UI::Request
- OpenID::URINorm
- OpenID::UndefinedOpenIDNamespace
- OpenID::Util
- OpenID::Yadis
- OpenID::Yadis::BasicServiceEndpoint
- OpenID::Yadis::CompoundFilter
- OpenID::Yadis::DiscoveryResult
- OpenID::Yadis::TransformFilterMaker
- OpenID::Yadis::XRDSError
- OpenID::Yadis::XRDSFraud
- OpenID::Yadis::XRI
- OpenID::Yadis::XRI::ProxyResolver
- OpenID::Yadis::XRI::XRIHTTPError
- HMAC
- HMAC::Base
- HMAC::SHA1
- HMAC::SHA256
- HMAC::SHA384
- HMAC::SHA512
- Net
- Net::HTTP
- HTMLComment
- HTMLTag
- HTMLText
- HTMLToken
- HTMLTokenizer
- HTMLTokenizerError
- Object

No matching classes.

# OpenID::Yadis::TransformFilterMaker

Take a list of basic filters and makes a filter that transforms the basic filter into a top-level filter. This is mostly useful for the implementation of make_filter, which should only be needed for special cases or internal use by this library.

This object is useful for creating simple filters for services that use one URI and are specified by one Type (we expect most Types will fit this paradigm).

Creates a BasicServiceEndpoint object and apply the filter functions to it until one of them returns a value.

### Attributes

filter_procs[R]

### Public Class Methods

new(filter_procs) click to toggle source

Initialize the filter maker's state

filter_functions are the endpoint transformer Procs to apply to the basic endpoint. These are called in turn until one of them does not return nil, and the result of that transformer is returned.

    # File lib/openid/yadis/filters.rb, line 75
    def initialize(filter_procs)
      @filter_procs = filter_procs
    end

### Public Instance Methods

apply_filters(endpoint) click to toggle source

    # File lib/openid/yadis/filters.rb, line 100
    def apply_filters(endpoint)
      # Apply filter procs to an endpoint until one of them returns
      # non-nil.
      @filter_procs.each { |filter_proc|
        e = filter_proc.call(endpoint)
        if !e.nil?
          # Once one of the filters has returned an endpoint, do not
          # apply any more.
          return e
        end
      }

      return nil
    end

get_service_endpoints(yadis_url, service_element) click to toggle source

Returns an array of endpoint objects produced by the filter procs.

    # File lib/openid/yadis/filters.rb, line 81
    def get_service_endpoints(yadis_url, service_element)
      endpoints = []

      # Do an expansion of the service element by xrd:Type and
      # xrd:URI
      Yadis::expand_service(service_element).each { |type_uris, uri, _|
        # Create a basic endpoint object to represent this
        # yadis_url, Service, Type, URI combination
        endpoint = BasicServiceEndpoint.new(
              yadis_url, type_uris, uri, service_element)

        e = apply_filters(endpoint)
        if !e.nil?
          endpoints << e
        end
      }
      return endpoints
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.