Class: Ably::Models::Stats::StatsStruct Private
- Inherits:
-
Object
- Object
- Ably::Models::Stats::StatsStruct
- Defined in:
- lib/submodules/ably-ruby/lib/ably/models/stats_types.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
StatsStruct is a basic Struct like class that allows methods to be defined on the class that will be retuned co-erced objects from the underlying hash used to initialize the object.
This class provides a concise way to create classes that have fixed attributes and types
Direct Known Subclasses
ConnectionTypes, MessageCount, MessageTraffic, MessageTypes, RequestCount, ResourceCount
Instance Attribute Summary collapse
- #hash ⇒ Object readonly private
Class Method Summary collapse
- .coerce_attributes(*attributes) ⇒ Object private
- .type_klass ⇒ Object private
Instance Method Summary collapse
-
#initialize(hash) ⇒ StatsStruct
constructor
private
A new instance of StatsStruct.
Constructor Details
#initialize(hash) ⇒ StatsStruct
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of StatsStruct.
46 47 48 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats_types.rb', line 46 def initialize(hash) @hash = hash || {} end |
Instance Attribute Details
#hash ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
44 45 46 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats_types.rb', line 44 def hash @hash end |
Class Method Details
.coerce_attributes(*attributes) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
18 19 20 21 22 23 24 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats_types.rb', line 18 def coerce_attributes(*attributes) = attributes.pop raise ArgumentError, 'Expected attribute into: within options hash' unless .kind_of?(Hash) && [:into] @type_klass = [:into] setup_attribute_methods attributes end |
.type_klass ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 |
# File 'lib/submodules/ably-ruby/lib/ably/models/stats_types.rb', line 26 def type_klass @type_klass end |