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.
5 6 7 |
# File 'lib/saml/kit/cli/yaml_registry.rb', line 5 def initialize(path) @items = YAML::Store.new(path) end |
Instance Method Details
#each ⇒ Object
24 25 26 27 28 29 30 |
# File 'lib/saml/kit/cli/yaml_registry.rb', line 24 def each with_transaction do |db| db.roots.each do |key| yield (key) end end end |
#metadata_for(entity_id) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/saml/kit/cli/yaml_registry.rb', line 16 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
9 10 11 12 13 14 |
# File 'lib/saml/kit/cli/yaml_registry.rb', line 9 def register() with_transaction do |db| db[.entity_id] = .to_xml end end |