Class: Marshalsea::Marshal::Result
- Inherits:
-
Object
- Object
- Marshalsea::Marshal::Result
- Defined in:
- lib/marshalsea/marshal/node.rb
Instance Attribute Summary collapse
-
#major ⇒ Object
readonly
Returns the value of attribute major.
-
#minor ⇒ Object
readonly
Returns the value of attribute minor.
-
#role_anomalies ⇒ Object
readonly
Returns the value of attribute role_anomalies.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #canonical_roles? ⇒ Boolean
- #canonical_version? ⇒ Boolean
- #class_names ⇒ Object
- #dispatching_hash_keys ⇒ Object
- #eql_dispatching_keys ⇒ Object
- #gated_sinks ⇒ Object
- #hash_dispatching_keys ⇒ Object
- #hash_keys ⇒ Object
-
#initialize(root, major:, minor:, role_anomalies: []) ⇒ Result
constructor
A new instance of Result.
- #nodes ⇒ Object
- #range_endpoint_dispatchers ⇒ Object
- #sinks ⇒ Object
Constructor Details
#initialize(root, major:, minor:, role_anomalies: []) ⇒ Result
Returns a new instance of Result.
118 119 120 121 122 123 |
# File 'lib/marshalsea/marshal/node.rb', line 118 def initialize(root, major:, minor:, role_anomalies: []) @root = root @major = major @minor = minor @role_anomalies = role_anomalies end |
Instance Attribute Details
#major ⇒ Object (readonly)
Returns the value of attribute major.
116 117 118 |
# File 'lib/marshalsea/marshal/node.rb', line 116 def major @major end |
#minor ⇒ Object (readonly)
Returns the value of attribute minor.
116 117 118 |
# File 'lib/marshalsea/marshal/node.rb', line 116 def minor @minor end |
#role_anomalies ⇒ Object (readonly)
Returns the value of attribute role_anomalies.
116 117 118 |
# File 'lib/marshalsea/marshal/node.rb', line 116 def role_anomalies @role_anomalies end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
116 117 118 |
# File 'lib/marshalsea/marshal/node.rb', line 116 def root @root end |
Instance Method Details
#canonical_roles? ⇒ Boolean
129 130 131 |
# File 'lib/marshalsea/marshal/node.rb', line 129 def canonical_roles? role_anomalies.empty? end |
#canonical_version? ⇒ Boolean
125 126 127 |
# File 'lib/marshalsea/marshal/node.rb', line 125 def canonical_version? major == Constants::MAJOR_VERSION && minor == Constants::MINOR_VERSION end |
#class_names ⇒ Object
137 138 139 |
# File 'lib/marshalsea/marshal/node.rb', line 137 def class_names nodes.filter_map(&:class_name).uniq end |
#dispatching_hash_keys ⇒ Object
156 157 158 |
# File 'lib/marshalsea/marshal/node.rb', line 156 def dispatching_hash_keys hash_keys.select(&:dispatches_key_methods?) end |
#eql_dispatching_keys ⇒ Object
164 165 166 |
# File 'lib/marshalsea/marshal/node.rb', line 164 def eql_dispatching_keys hash_keys.filter_map(&:eql_dispatcher) end |
#gated_sinks ⇒ Object
145 146 147 |
# File 'lib/marshalsea/marshal/node.rb', line 145 def gated_sinks sinks.select(&:gated?) end |
#hash_dispatching_keys ⇒ Object
160 161 162 |
# File 'lib/marshalsea/marshal/node.rb', line 160 def hash_dispatching_keys hash_keys.filter_map(&:hash_dispatcher) end |
#hash_keys ⇒ Object
149 150 151 152 153 154 |
# File 'lib/marshalsea/marshal/node.rb', line 149 def hash_keys nodes.select { |node| node.type == :hash } .flat_map(&:children) .select { |child| child.type == :pair } .filter_map { |pair| pair.children.first } end |
#nodes ⇒ Object
133 134 135 |
# File 'lib/marshalsea/marshal/node.rb', line 133 def nodes root.each end |
#range_endpoint_dispatchers ⇒ Object
168 169 170 171 |
# File 'lib/marshalsea/marshal/node.rb', line 168 def range_endpoint_dispatchers nodes.select { |node| node.effective_class_name == Constants::RANGE_CLASS_NAME } .flat_map(&:range_endpoints) end |
#sinks ⇒ Object
141 142 143 |
# File 'lib/marshalsea/marshal/node.rb', line 141 def sinks nodes.select(&:sink?) end |