Module: Exegesis::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.
19 20 21 |
# File 'lib/exegesis/file_system_entity.rb', line 19 def name @name end |
#parent ⇒ Object (readonly) Also known as: container
Returns the value of attribute parent.
19 20 21 |
# File 'lib/exegesis/file_system_entity.rb', line 19 def parent @parent end |
Instance Method Details
#basename ⇒ Object
22 23 24 |
# File 'lib/exegesis/file_system_entity.rb', line 22 def basename File.basename(name, ext) end |
#ext ⇒ Object Also known as: extension
26 27 28 |
# File 'lib/exegesis/file_system_entity.rb', line 26 def ext @ext || "" end |
#inspect ⇒ Object
15 16 17 |
# File 'lib/exegesis/file_system_entity.rb', line 15 def inspect "#{self.class.inspect}(#{path.inspect})" end |
#path ⇒ Object
11 12 13 |
# File 'lib/exegesis/file_system_entity.rb', line 11 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 |