Module: FileSystemEntity::Methods
- Defined in:
- lib/exegesis/file_system_entity.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
(also: #container)
readonly
Returns the value of attribute parent.
Instance Method Summary collapse
- #basename ⇒ Object
- #ext ⇒ Object (also: #extension)
- #inspect ⇒ Object
- #path ⇒ Object
- #visit(visitor) ⇒ Object
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
18 19 20 |
# File 'lib/exegesis/file_system_entity.rb', line 18 def name @name end |
#parent ⇒ Object (readonly) Also known as: container
Returns the value of attribute parent.
18 19 20 |
# File 'lib/exegesis/file_system_entity.rb', line 18 def parent @parent end |
Instance Method Details
#basename ⇒ Object
21 22 23 |
# File 'lib/exegesis/file_system_entity.rb', line 21 def basename File.basename(name, ext) end |
#ext ⇒ Object Also known as: extension
25 26 27 |
# File 'lib/exegesis/file_system_entity.rb', line 25 def ext @ext || "" end |
#inspect ⇒ Object
14 15 16 |
# File 'lib/exegesis/file_system_entity.rb', line 14 def inspect "#{self.class.inspect}(#{path.inspect})" end |
#path ⇒ Object
10 11 12 |
# File 'lib/exegesis/file_system_entity.rb', line 10 def path File.join(parent.path, name) end |
#visit(visitor) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/exegesis/file_system_entity.rb', line 31 def visit(visitor) visitor.on_enter if visitor.respond_to? :on_enter visitor.call(self.class, self) if respond_to?(:directories) directories.each do |dir| dir.visit(visitor) end end if respond_to?(:files) files.each do |file| file.visit(visitor) end end visitor.on_exit if visitor.respond_to? :on_exit end |