Class: Mutiny::Subjects::Subject
- Inherits:
-
Object
- Object
- Mutiny::Subjects::Subject
- Defined in:
- lib/mutiny/subjects/subject.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#root ⇒ Object
readonly
Returns the value of attribute root.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(name:, path: nil, root: nil) ⇒ Subject
constructor
A new instance of Subject.
- #relative_path ⇒ Object
Constructor Details
#initialize(name:, path: nil, root: nil) ⇒ Subject
8 9 10 11 12 |
# File 'lib/mutiny/subjects/subject.rb', line 8 def initialize(name:, path: nil, root: nil) @name = name @path = path @root = root end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
6 7 8 |
# File 'lib/mutiny/subjects/subject.rb', line 6 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
6 7 8 |
# File 'lib/mutiny/subjects/subject.rb', line 6 def path @path end |
#root ⇒ Object (readonly)
Returns the value of attribute root.
6 7 8 |
# File 'lib/mutiny/subjects/subject.rb', line 6 def root @root end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
21 22 23 |
# File 'lib/mutiny/subjects/subject.rb', line 21 def eql?(other) is_a?(other.class) && other.name == name && other.path == path && other.root == root end |
#hash ⇒ Object
27 28 29 |
# File 'lib/mutiny/subjects/subject.rb', line 27 def hash [name, path, root].hash end |
#relative_path ⇒ Object
14 15 16 17 18 19 |
# File 'lib/mutiny/subjects/subject.rb', line 14 def relative_path absolute_path = Pathname.new(path) root_path = Pathname.new(root) absolute_path.relative_path_from(root_path).to_s end |