class SamlTool::Reader

Attributes

config[R]
namespaces[R]
saml[R]

Public Class Methods

new(saml, config = {}, namespaces = nil) click to toggle source
# File lib/saml_tool/reader.rb, line 14
def initialize(saml, config = {}, namespaces = nil)
  @saml = SamlTool::SAML(saml)
  @config = Hashie::Mash.new(config)
  @namespaces = namespaces
  build_methods
end

Public Instance Methods

to_hash() click to toggle source
# File lib/saml_tool/reader.rb, line 21
def to_hash
  config.keys.inject({}){|hash, key| hash[key.to_sym] = send(key.to_sym); hash}
end

Private Instance Methods

build_methods() click to toggle source
# File lib/saml_tool/reader.rb, line 26
def build_methods
  @config.each do |key, value|
    self.class.send :attr_reader, key.to_sym
    source = saml.xpath(value, namespaces)
    content = Content.new(source)
    instance_variable_set("@#{key}".to_sym, content)
  end
end