Class: Artifact::ReadableFile
- Inherits:
-
Object
- Object
- Artifact::ReadableFile
- Defined in:
- lib/artifact.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#full_path ⇒ Object
readonly
Returns the value of attribute full_path.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #body ⇒ Object
- #dirname ⇒ Object
- #exists? ⇒ Boolean
- #filename ⇒ Object
-
#initialize(path) ⇒ ReadableFile
constructor
A new instance of ReadableFile.
- #last_modified ⇒ Object
- #meta ⇒ Object
- #slug ⇒ Object
Constructor Details
#initialize(path) ⇒ ReadableFile
Returns a new instance of ReadableFile.
267 268 269 270 271 272 273 274 275 |
# File 'lib/artifact.rb', line 267 def initialize(path) if path[Artifact.root] # path contains root, meaning absolute path @path = Artifact.relative_path(path) @full_path = path else @path = path @full_path = Artifact.full_path(path) end end |
Instance Attribute Details
#full_path ⇒ Object (readonly)
Returns the value of attribute full_path.
265 266 267 |
# File 'lib/artifact.rb', line 265 def full_path @full_path end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
265 266 267 |
# File 'lib/artifact.rb', line 265 def path @path end |
Instance Method Details
#body ⇒ Object
293 294 295 |
# File 'lib/artifact.rb', line 293 def body @content end |
#dirname ⇒ Object
285 286 287 |
# File 'lib/artifact.rb', line 285 def dirname File.dirname(full_path) end |
#exists? ⇒ Boolean
301 302 303 |
# File 'lib/artifact.rb', line 301 def exists? File.exist?(full_path) end |
#filename ⇒ Object
277 278 279 |
# File 'lib/artifact.rb', line 277 def filename File.basename(path) end |
#last_modified ⇒ Object
289 290 291 |
# File 'lib/artifact.rb', line 289 def last_modified File.mtime(full_path) end |
#meta ⇒ Object
297 298 299 |
# File 'lib/artifact.rb', line 297 def {} end |
#slug ⇒ Object
281 282 283 |
# File 'lib/artifact.rb', line 281 def slug File.basename(path, File.extname(path)) end |