Module: DocumentFile
- Extended by:
- ActiveSupport::Concern
- Defined in:
- lib/document_file.rb,
lib/document_file/version.rb,
lib/document_file/collection.rb
Defined Under Namespace
Modules: ClassMethods Classes: Collection
Constant Summary collapse
- VERSION =
'0.0.8'
Instance Attribute Summary collapse
-
#content ⇒ Object
readonly
Returns the value of attribute content.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#file_path ⇒ Object
readonly
Returns the value of attribute file_path.
Instance Method Summary collapse
- #file_extension ⇒ Object
- #file_name ⇒ Object
- #file_name_with_extension ⇒ Object
- #initialize(new_file_path) ⇒ Object
Instance Attribute Details
#content ⇒ Object (readonly)
Returns the value of attribute content.
15 16 17 |
# File 'lib/document_file.rb', line 15 def content @content end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
15 16 17 |
# File 'lib/document_file.rb', line 15 def data @data end |
#file_path ⇒ Object (readonly)
Returns the value of attribute file_path.
15 16 17 |
# File 'lib/document_file.rb', line 15 def file_path @file_path end |
Instance Method Details
#file_extension ⇒ Object
34 35 36 |
# File 'lib/document_file.rb', line 34 def file_extension File.extname file_name_with_extension end |
#file_name ⇒ Object
26 27 28 |
# File 'lib/document_file.rb', line 26 def file_name File.basename file_name_with_extension, file_extension end |
#file_name_with_extension ⇒ Object
30 31 32 |
# File 'lib/document_file.rb', line 30 def file_name_with_extension self.file_path.split('/').last end |
#initialize(new_file_path) ⇒ Object
17 18 19 20 21 22 23 24 |
# File 'lib/document_file.rb', line 17 def initialize(new_file_path) @file_path = if File.exist? new_file_path new_file_path else [self.documents_dir, new_file_path].join('/') end read_yaml end |