Class: Arcp::Session::CapabilitySet
- Inherits:
-
Data
- Object
- Data
- Arcp::Session::CapabilitySet
- Defined in:
- lib/arcp/session/capability_set.rb
Constant Summary collapse
- DEFAULT_ENCODINGS =
%w[utf8 base64].freeze
Instance Attribute Summary collapse
-
#agents ⇒ Object
readonly
Returns the value of attribute agents.
-
#encodings ⇒ Object
readonly
Returns the value of attribute encodings.
-
#features ⇒ Object
readonly
Returns the value of attribute features.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#agents ⇒ Object (readonly)
Returns the value of attribute agents
5 6 7 |
# File 'lib/arcp/session/capability_set.rb', line 5 def agents @agents end |
#encodings ⇒ Object (readonly)
Returns the value of attribute encodings
5 6 7 |
# File 'lib/arcp/session/capability_set.rb', line 5 def encodings @encodings end |
#features ⇒ Object (readonly)
Returns the value of attribute features
5 6 7 |
# File 'lib/arcp/session/capability_set.rb', line 5 def features @features end |
Class Method Details
.local(features: Feature::ALL, encodings: DEFAULT_ENCODINGS, agents: nil) ⇒ Object
8 9 10 |
# File 'lib/arcp/session/capability_set.rb', line 8 def self.local(features: Feature::ALL, encodings: DEFAULT_ENCODINGS, agents: nil) new(features: features.dup.freeze, encodings: encodings.dup.freeze, agents: agents) end |
Instance Method Details
#intersect(other) ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/arcp/session/capability_set.rb', line 12 def intersect(other) self.class.new( features: (features & other.features).freeze, encodings: (encodings & other.encodings).freeze, agents: other.agents || agents ) end |
#supports?(feature) ⇒ Boolean
20 |
# File 'lib/arcp/session/capability_set.rb', line 20 def supports?(feature) = features.include?(feature) |
#to_h ⇒ Object
22 23 24 25 26 |
# File 'lib/arcp/session/capability_set.rb', line 22 def to_h h = { 'features' => features, 'encodings' => encodings } h['agents'] = agents.to_a if agents h end |