Class: Rakyll::Compiler::Match

Inherits:
Object
  • Object
show all
Includes:
Apply, SetFilename
Defined in:
lib/rakyll/compiler/match.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SetFilename

#set_filename

Methods included from Apply

#apply

Constructor Details

#initialize(source_filename, opts) ⇒ Match

Returns a new instance of Match.



8
9
10
11
12
13
14
# File 'lib/rakyll/compiler/match.rb', line 8

def initialize(source_filename, opts)
  @source_filename = source_filename
  metadatas, markdown_string = YAML::FrontMatter.extract(File.read(@source_filename))
  set_metadatas(metadatas)
  set_body_from_markdown(markdown_string, opts)
  set_filename(source_filename, '.html')
end

Instance Attribute Details

#bodyObject (readonly)

Returns the value of attribute body.



6
7
8
# File 'lib/rakyll/compiler/match.rb', line 6

def body
  @body
end

#urlObject (readonly)

Returns the value of attribute url.



6
7
8
# File 'lib/rakyll/compiler/match.rb', line 6

def url
  @url
end

Instance Method Details

#saveObject



16
17
18
# File 'lib/rakyll/compiler/match.rb', line 16

def save
  File.write(@filename, @body)
end