Class: Toys::SourceSpec::Base
- Inherits:
-
Object
- Object
- Toys::SourceSpec::Base
- Defined in:
- lib/toys/source_spec.rb
Overview
The base class of a source spec, holding the attributes common to every kind, and implementing equality.
Do not instantiate this class directly. Use one of the factory methods such as path.
Instance Attribute Summary collapse
-
#context_directory ⇒ String?
readonly
The context directory for tools loaded from this source, or nil if the source does not dictate a context directory.
-
#source_name ⇒ String?
readonly
The user-visible name for tools loaded from this source, or
nilto generate a default at resolution time.
Instance Method Summary collapse
-
#==(other) ⇒ boolean
(also: #eql?)
Source specs compare by value.
- #hash ⇒ Integer
Instance Attribute Details
#context_directory ⇒ String? (readonly)
The context directory for tools loaded from this source, or nil if the source does not dictate a context directory.
194 195 196 |
# File 'lib/toys/source_spec.rb', line 194 def context_directory @context_directory end |
#source_name ⇒ String? (readonly)
The user-visible name for tools loaded from this source, or nil to
generate a default at resolution time.
202 203 204 |
# File 'lib/toys/source_spec.rb', line 202 def source_name @source_name end |
Instance Method Details
#==(other) ⇒ boolean Also known as: eql?
Source specs compare by value. Specs of different kinds are never equal, even if their common attributes match.
211 212 213 |
# File 'lib/toys/source_spec.rb', line 211 def ==(other) other.class.equal?(self.class) && other.equality_fields == equality_fields end |
#hash ⇒ Integer
219 220 221 |
# File 'lib/toys/source_spec.rb', line 219 def hash equality_fields.hash end |