Class: Jeog::File
- Inherits:
-
Object
- Object
- Jeog::File
- Defined in:
- lib/jeog/file.rb
Instance Attribute Summary collapse
-
#directory ⇒ Object
Returns the value of attribute directory.
-
#file ⇒ Object
Returns the value of attribute file.
-
#file_name ⇒ Object
Returns the value of attribute file_name.
Instance Method Summary collapse
- #alternative_json_file ⇒ Object
-
#initialize(file_name) ⇒ File
constructor
A new instance of File.
- #json_data ⇒ Object
- #raw_data ⇒ Object
- #stat ⇒ Object
Constructor Details
#initialize(file_name) ⇒ File
Returns a new instance of File.
7 8 9 10 |
# File 'lib/jeog/file.rb', line 7 def initialize(file_name) @file_name = file_name @directory, @file = ::File.split file_name end |
Instance Attribute Details
#directory ⇒ Object
Returns the value of attribute directory.
5 6 7 |
# File 'lib/jeog/file.rb', line 5 def directory @directory end |
#file ⇒ Object
Returns the value of attribute file.
5 6 7 |
# File 'lib/jeog/file.rb', line 5 def file @file end |
#file_name ⇒ Object
Returns the value of attribute file_name.
5 6 7 |
# File 'lib/jeog/file.rb', line 5 def file_name @file_name end |
Instance Method Details
#alternative_json_file ⇒ Object
24 25 26 |
# File 'lib/jeog/file.rb', line 24 def alternative_json_file "#{@file.gsub(/\.jeog/, '')}.json" end |
#json_data ⇒ Object
20 21 22 |
# File 'lib/jeog/file.rb', line 20 def json_data ::IO.read(@file_name, nil, 4) end |
#raw_data ⇒ Object
16 17 18 |
# File 'lib/jeog/file.rb', line 16 def raw_data ::IO.read @file_name end |
#stat ⇒ Object
12 13 14 |
# File 'lib/jeog/file.rb', line 12 def stat ::File.stat @file_name end |