Class: PokeApi::Common::Encounter
- Inherits:
-
Object
- Object
- PokeApi::Common::Encounter
- Includes:
- AssignmentHelpers
- Defined in:
- lib/poke_api/common/encounter.rb
Overview
Encounter object handling lists of EncounterMethod and EncounterConditionValue
Instance Attribute Summary collapse
-
#chance ⇒ Object
readonly
Returns the value of attribute chance.
-
#condition_values ⇒ Object
readonly
Returns the value of attribute condition_values.
-
#max_level ⇒ Object
readonly
Returns the value of attribute max_level.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#min_level ⇒ Object
readonly
Returns the value of attribute min_level.
Instance Method Summary collapse
-
#initialize(data) ⇒ Encounter
constructor
A new instance of Encounter.
Methods included from AssignmentHelpers
assign_list, custom_endpoint_object, endpoint_assignment, get_named_api_resource_from_url, try_to_assign
Constructor Details
#initialize(data) ⇒ Encounter
Returns a new instance of Encounter.
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/poke_api/common/encounter.rb', line 13 def initialize(data) @chance = data[:chance] @condition_values = assign_list( data: data[:condition_values], klass: PokeApi::EncounterConditionValue ) @max_level = data[:max_level] @method = PokeApi::EncounterMethod.new(data[:method]) @min_level = data[:min_level] end |
Instance Attribute Details
#chance ⇒ Object (readonly)
Returns the value of attribute chance.
7 8 9 |
# File 'lib/poke_api/common/encounter.rb', line 7 def chance @chance end |
#condition_values ⇒ Object (readonly)
Returns the value of attribute condition_values.
7 8 9 |
# File 'lib/poke_api/common/encounter.rb', line 7 def condition_values @condition_values end |
#max_level ⇒ Object (readonly)
Returns the value of attribute max_level.
7 8 9 |
# File 'lib/poke_api/common/encounter.rb', line 7 def max_level @max_level end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
7 8 9 |
# File 'lib/poke_api/common/encounter.rb', line 7 def method @method end |
#min_level ⇒ Object (readonly)
Returns the value of attribute min_level.
7 8 9 |
# File 'lib/poke_api/common/encounter.rb', line 7 def min_level @min_level end |