Class: Continuum::ClusteringData
- Inherits:
-
Object
- Object
- Continuum::ClusteringData
- Defined in:
- src/lib/continuum/clustering_data.rb
Overview
Encapsulates all of the data related to clustering within a page for a single test result
Instance Attribute Summary collapse
-
#attributes ⇒ Hash
Gets the attribute names and value for the element associated with this clustering data.
-
#children ⇒ Array<ClusteringData>
Gets the array of child clustering data.
-
#tag_name ⇒ String
Gets the name of the element associated with this clustering data.
-
#text ⇒ String
Gets the inner text for the element associated with this clustering data.
-
#unique_id ⇒ String
Gets the id that uniquely identifies this clustering data.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(unique_id, tag_name, attributes, text, children) ⇒ ClusteringData
constructor
A new instance of ClusteringData.
Constructor Details
#initialize(unique_id, tag_name, attributes, text, children) ⇒ ClusteringData
Returns a new instance of ClusteringData.
41 42 43 44 45 46 47 |
# File 'src/lib/continuum/clustering_data.rb', line 41 def initialize(unique_id, tag_name, attributes, text, children) @unique_id = unique_id @tag_name = tag_name @attributes = attributes @text = text @children = children end |
Instance Attribute Details
#attributes ⇒ Hash
Gets the attribute names and value for the element associated with this clustering data.
24 25 26 |
# File 'src/lib/continuum/clustering_data.rb', line 24 def attributes @attributes end |
#children ⇒ Array<ClusteringData>
Gets the array of child clustering data.
34 35 36 |
# File 'src/lib/continuum/clustering_data.rb', line 34 def children @children end |
#tag_name ⇒ String
Gets the name of the element associated with this clustering data.
19 20 21 |
# File 'src/lib/continuum/clustering_data.rb', line 19 def tag_name @tag_name end |
#text ⇒ String
Gets the inner text for the element associated with this clustering data.
29 30 31 |
# File 'src/lib/continuum/clustering_data.rb', line 29 def text @text end |
#unique_id ⇒ String
Gets the id that uniquely identifies this clustering data.
14 15 16 |
# File 'src/lib/continuum/clustering_data.rb', line 14 def unique_id @unique_id end |
Class Method Details
.from_json(json_data) ⇒ AccessibilityConcern
51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'src/lib/continuum/clustering_data.rb', line 51 def self.from_json(json_data) parsed = DataUtil.parse_json(json_data) || {} children = parsed['children'].map do |child_data| ClusteringData.from_json(child_data) end return new( parsed['uniqueId'], parsed['tagName'], parsed['attributes'], parsed['text'], children ) end |