Class: Flue::Basefile

Inherits:
Object
  • Object
show all
Defined in:
lib/flue/basefile.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options={})
  @filename = filename
  @options = options
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



5
6
7
# File 'lib/flue/basefile.rb', line 5

def filename
  @filename
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/flue/basefile.rb', line 5

def options
  @options
end

Instance Method Details

#basenameObject



20
21
22
# File 'lib/flue/basefile.rb', line 20

def basename
  File.basename filename
end

#contentObject



50
51
52
# File 'lib/flue/basefile.rb', line 50

def content
  File.read(filename)
end

#datafileObject



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_basenameObject



36
37
38
# File 'lib/flue/basefile.rb', line 36

def datafile_basename
  [parts[0], "yml"].join(".")
end

#datafile_nameObject



40
41
42
# File 'lib/flue/basefile.rb', line 40

def datafile_name
  [dirname, datafile_basename].join("/")
end

#dirnameObject



16
17
18
# File 'lib/flue/basefile.rb', line 16

def dirname
  File.dirname filename
end

#extsObject



24
25
26
# File 'lib/flue/basefile.rb', line 24

def exts
  parts[1..-2]
end

#outfile_basenameObject



28
29
30
# File 'lib/flue/basefile.rb', line 28

def outfile_basename
  [parts[0], parts[-1]].join(".")
end

#outfile_nameObject



32
33
34
# File 'lib/flue/basefile.rb', line 32

def outfile_name
  ["_site", outfile_basename].join("/")
end

#partsObject



12
13
14
# File 'lib/flue/basefile.rb', line 12

def parts
  basename.split(".")
end