Class: Sortah::Destination
- Inherits:
-
Object
- Object
- Sortah::Destination
- Defined in:
- lib/sortah/components/destination.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
- #alias? ⇒ Boolean
- #defined?(context) ⇒ Boolean
-
#initialize(name, path) ⇒ Destination
constructor
A new instance of Destination.
- #to_s ⇒ Object
Constructor Details
#initialize(name, path) ⇒ Destination
Returns a new instance of Destination.
22 23 24 25 |
# File 'lib/sortah/components/destination.rb', line 22 def initialize(name, path) @name = name @path = if path.class == Hash then path[:abs] else path end end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
16 17 18 |
# File 'lib/sortah/components/destination.rb', line 16 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
16 17 18 |
# File 'lib/sortah/components/destination.rb', line 16 def path @path end |
Class Method Details
.dynamic(path) ⇒ Object
18 19 20 |
# File 'lib/sortah/components/destination.rb', line 18 def self.dynamic(path) Destination.new(nil, path) end |
Instance Method Details
#==(other) ⇒ Object
35 36 37 38 39 |
# File 'lib/sortah/components/destination.rb', line 35 def ==(other) (other.class == Destination && other.name == @name && other.path == @path) || @path == other || super end |
#alias? ⇒ Boolean
31 32 33 |
# File 'lib/sortah/components/destination.rb', line 31 def alias? @path.class == Symbol end |
#defined?(context) ⇒ Boolean
27 28 29 |
# File 'lib/sortah/components/destination.rb', line 27 def defined?(context) context.include?(@name) end |
#to_s ⇒ Object
41 42 43 |
# File 'lib/sortah/components/destination.rb', line 41 def to_s @path end |