Class: WeatherForecasts::Client::SelectionAttributes
- Inherits:
-
Object
- Object
- WeatherForecasts::Client::SelectionAttributes
- Defined in:
- lib/weather_forecasts/client/query/selection_attributes.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ SelectionAttributes
constructor
A new instance of SelectionAttributes.
- #valid?(attr) ⇒ Boolean
Constructor Details
#initialize(attributes) ⇒ SelectionAttributes
Returns a new instance of SelectionAttributes.
8 9 10 |
# File 'lib/weather_forecasts/client/query/selection_attributes.rb', line 8 def initialize(attributes) @attributes = Array.wrap(attributes) end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
6 7 8 |
# File 'lib/weather_forecasts/client/query/selection_attributes.rb', line 6 def attributes @attributes end |
Instance Method Details
#valid?(attr) ⇒ Boolean
12 13 14 15 16 |
# File 'lib/weather_forecasts/client/query/selection_attributes.rb', line 12 def valid?(attr) unless attributes.include?(attr) raise InvalidSelectionAttributeError, "The selection attribute, `#{attr}`, is not a valid attribute on this query." end end |