Class: Inspector::Metadata::Map
- Inherits:
-
Object
- Object
- Inspector::Metadata::Map
- Defined in:
- lib/inspector/metadata/map.rb
Instance Method Summary collapse
- #[](type) ⇒ Object
- #[]=(type, metadata) ⇒ Object
-
#initialize ⇒ Map
constructor
A new instance of Map.
Constructor Details
#initialize ⇒ Map
Returns a new instance of Map.
4 5 6 |
# File 'lib/inspector/metadata/map.rb', line 4 def initialize @map = {} end |
Instance Method Details
#[](type) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/inspector/metadata/map.rb', line 16 def [](type) @map.fetch(type) rescue KeyError raise "validation information for #{type.inspect} doesn't exist, use " + "Inspector.valid(#{type.inspect}) to define it" end |
#[]=(type, metadata) ⇒ Object
8 9 10 11 12 13 14 |
# File 'lib/inspector/metadata/map.rb', line 8 def []=(type, ) unless .kind_of?(Metadata) raise "#{.inspect} is not a Inspector::Metadata" end @map[type] = end |