Class: Necropsy::UnknownScope
- Inherits:
-
Data
- Object
- Data
- Necropsy::UnknownScope
- Defined in:
- lib/necropsy/models.rb
Instance Attribute Summary collapse
-
#match ⇒ Object
readonly
Returns the value of attribute match.
-
#scope_kind ⇒ Object
readonly
Returns the value of attribute scope_kind.
-
#scope_value ⇒ Object
readonly
Returns the value of attribute scope_value.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(scope_kind:, scope_value:, match:) ⇒ UnknownScope
constructor
A new instance of UnknownScope.
- #to_h ⇒ Object
Constructor Details
#initialize(scope_kind:, scope_value:, match:) ⇒ UnknownScope
Returns a new instance of UnknownScope.
104 105 106 107 108 109 110 111 112 |
# File 'lib/necropsy/models.rb', line 104 def initialize(scope_kind:, scope_value:, match:) scope_kind = scope_kind.to_sym if scope_kind.respond_to?(:to_sym) match = match.to_sym if match.respond_to?(:to_sym) raise ArgumentError, "invalid unknown scope kind: #{scope_kind.inspect}" unless UNKNOWN_SCOPE_KINDS.include?(scope_kind) raise ArgumentError, "invalid unknown scope match: #{match.inspect}" unless UNKNOWN_SCOPE_MATCHES.include?(match) scope_value = ModelNormalization.scope_value(scope_value) super end |
Instance Attribute Details
#match ⇒ Object (readonly)
Returns the value of attribute match
103 104 105 |
# File 'lib/necropsy/models.rb', line 103 def match @match end |
#scope_kind ⇒ Object (readonly)
Returns the value of attribute scope_kind
103 104 105 |
# File 'lib/necropsy/models.rb', line 103 def scope_kind @scope_kind end |
#scope_value ⇒ Object (readonly)
Returns the value of attribute scope_value
103 104 105 |
# File 'lib/necropsy/models.rb', line 103 def scope_value @scope_value end |
Class Method Details
.from_h(attributes) ⇒ Object
114 115 116 117 118 119 120 121 |
# File 'lib/necropsy/models.rb', line 114 def self.from_h(attributes) data = ModelNormalization.attributes(attributes, name) new( scope_kind: data.fetch('scope_kind'), scope_value: data.fetch('scope_value'), match: data.fetch('match') ) end |
Instance Method Details
#to_h ⇒ Object
123 124 125 126 127 128 129 |
# File 'lib/necropsy/models.rb', line 123 def to_h { 'scope_kind' => scope_kind.to_s, 'scope_value' => scope_value, 'match' => match.to_s } end |