Class: Ld::Node
- Inherits:
-
Object
- Object
- Ld::Node
- Defined in:
- lib/ld.rb,
lib/ld/node.rb
Instance Attribute Summary collapse
-
#depth ⇒ Object
Returns the value of attribute depth.
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#path ⇒ Object
Returns the value of attribute path.
-
#suffix ⇒ Object
Returns the value of attribute suffix.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(id, depth, path) ⇒ Node
constructor
A new instance of Node.
Constructor Details
#initialize(id, depth, path) ⇒ Node
Returns a new instance of Node.
4 5 6 7 8 9 10 11 |
# File 'lib/ld/node.rb', line 4 def initialize id, depth, path @id = id @depth = depth @path = path @type = File.directory?(path) ? 1 : 0 @name = File.basename path @suffix = @type == 1 ? nil : @name.split('.').last end |
Instance Attribute Details
#depth ⇒ Object
Returns the value of attribute depth.
2 3 4 |
# File 'lib/ld/node.rb', line 2 def depth @depth end |
#id ⇒ Object
Returns the value of attribute id.
2 3 4 |
# File 'lib/ld/node.rb', line 2 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
2 3 4 |
# File 'lib/ld/node.rb', line 2 def name @name end |
#path ⇒ Object
Returns the value of attribute path.
2 3 4 |
# File 'lib/ld/node.rb', line 2 def path @path end |
#suffix ⇒ Object
Returns the value of attribute suffix.
2 3 4 |
# File 'lib/ld/node.rb', line 2 def suffix @suffix end |
#type ⇒ Object
Returns the value of attribute type.
2 3 4 |
# File 'lib/ld/node.rb', line 2 def type @type end |