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.
208 209 210 |
# File 'lib/toys/source_spec.rb', line 208 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.
216 217 218 |
# File 'lib/toys/source_spec.rb', line 216 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.
225 226 227 |
# File 'lib/toys/source_spec.rb', line 225 def ==(other) other.class.equal?(self.class) && other.equality_fields == equality_fields end |
#hash ⇒ Integer
233 234 235 |
# File 'lib/toys/source_spec.rb', line 233 def hash equality_fields.hash end |