Class: LocalPac::File
- Inherits:
-
Object
- Object
- LocalPac::File
- Defined in:
- lib/local_pac/file.rb
Instance Attribute Summary collapse
-
#compressed_content ⇒ Object
Returns the value of attribute compressed_content.
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
- #extension?(ext) ⇒ Boolean
-
#initialize(path, content = '') ⇒ File
constructor
A new instance of File.
- #nil? ⇒ Boolean
- #prepare(handler) ⇒ Object
Constructor Details
#initialize(path, content = '') ⇒ File
Returns a new instance of File.
13 14 15 16 17 18 |
# File 'lib/local_pac/file.rb', line 13 def initialize(path, content = '') @path = path @extension = ::File.extname(path) @name = path.sub(/\.[^.]+$/, '').gsub(%r{/}, '::').downcase.to_sym @content = content end |
Instance Attribute Details
#compressed_content ⇒ Object
Returns the value of attribute compressed_content.
10 11 12 |
# File 'lib/local_pac/file.rb', line 10 def compressed_content @compressed_content end |
#content ⇒ Object (readonly)
Returns the value of attribute content.
11 12 13 |
# File 'lib/local_pac/file.rb', line 11 def content @content end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
11 12 13 |
# File 'lib/local_pac/file.rb', line 11 def name @name end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
11 12 13 |
# File 'lib/local_pac/file.rb', line 11 def path @path end |
Instance Method Details
#extension?(ext) ⇒ Boolean
24 25 26 |
# File 'lib/local_pac/file.rb', line 24 def extension?(ext) extension == ext end |
#nil? ⇒ Boolean
20 21 22 |
# File 'lib/local_pac/file.rb', line 20 def nil? false end |
#prepare(handler) ⇒ Object
28 29 30 |
# File 'lib/local_pac/file.rb', line 28 def prepare(handler) handler.prepare(self) end |