Class: Saml::Kit::Cli::YamlRegistry
- Inherits:
-
DefaultRegistry
- Object
- DefaultRegistry
- Saml::Kit::Cli::YamlRegistry
- Defined in:
- lib/saml/kit/cli/yaml_registry.rb
Instance Method Summary collapse
- #each ⇒ Object
-
#initialize(path) ⇒ YamlRegistry
constructor
A new instance of YamlRegistry.
- #metadata_for(entity_id) ⇒ Object
- #register(metadata) ⇒ Object
Constructor Details
#initialize(path) ⇒ YamlRegistry
Returns a new instance of YamlRegistry.
7 8 9 |
# File 'lib/saml/kit/cli/yaml_registry.rb', line 7 def initialize(path) @items = YAML::Store.new(path) end |
Instance Method Details
#each ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/saml/kit/cli/yaml_registry.rb', line 26 def each with_transaction do |db| db.roots.each do |key| yield (key) end end end |
#metadata_for(entity_id) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/saml/kit/cli/yaml_registry.rb', line 18 def (entity_id) with_transaction do |db| xml = db[entity_id] return nil if xml.nil? Saml::Kit::Metadata.from(xml) end end |
#register(metadata) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/saml/kit/cli/yaml_registry.rb', line 11 def register() with_transaction do |db| db[.entity_id] = .to_xml end end |