Class: Flue::Basefile
- Inherits:
-
Object
- Object
- Flue::Basefile
- Defined in:
- lib/flue/basefile.rb
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #basename ⇒ Object
- #content ⇒ Object
- #datafile ⇒ Object
- #datafile_basename ⇒ Object
- #datafile_name ⇒ Object
- #dirname ⇒ Object
- #exts ⇒ Object
-
#initialize(filename, options = {}) ⇒ Basefile
constructor
A new instance of Basefile.
- #outfile_basename ⇒ Object
- #outfile_name ⇒ Object
- #parts ⇒ Object
Constructor Details
#initialize(filename, options = {}) ⇒ Basefile
Returns a new instance of Basefile.
7 8 9 10 |
# File 'lib/flue/basefile.rb', line 7 def initialize(filename, ={}) @filename = filename @options = end |
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
5 6 7 |
# File 'lib/flue/basefile.rb', line 5 def filename @filename end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/flue/basefile.rb', line 5 def @options end |
Instance Method Details
#basename ⇒ Object
20 21 22 |
# File 'lib/flue/basefile.rb', line 20 def basename File.basename filename end |
#content ⇒ Object
50 51 52 |
# File 'lib/flue/basefile.rb', line 50 def content File.read(filename) end |
#datafile ⇒ Object
44 45 46 47 48 |
# File 'lib/flue/basefile.rb', line 44 def datafile if File.exists? datafile_name File.read(datafile_name) end end |
#datafile_basename ⇒ Object
36 37 38 |
# File 'lib/flue/basefile.rb', line 36 def datafile_basename [parts[0], "yml"].join(".") end |
#datafile_name ⇒ Object
40 41 42 |
# File 'lib/flue/basefile.rb', line 40 def datafile_name [dirname, datafile_basename].join("/") end |
#dirname ⇒ Object
16 17 18 |
# File 'lib/flue/basefile.rb', line 16 def dirname File.dirname filename end |
#exts ⇒ Object
24 25 26 |
# File 'lib/flue/basefile.rb', line 24 def exts parts[1..-2] end |
#outfile_basename ⇒ Object
28 29 30 |
# File 'lib/flue/basefile.rb', line 28 def outfile_basename [parts[0], parts[-1]].join(".") end |
#outfile_name ⇒ Object
32 33 34 |
# File 'lib/flue/basefile.rb', line 32 def outfile_name ["_site", outfile_basename].join("/") end |
#parts ⇒ Object
12 13 14 |
# File 'lib/flue/basefile.rb', line 12 def parts basename.split(".") end |