Class: DressCode::Document

Inherits:
Object
  • Object
show all
Defined in:
lib/dress_code/document.rb

Constant Summary collapse

MD =
Redcarpet::Markdown.new(DressCode::Renderer.new, {
  fenced_code_blocks: true,
  strikethrough: true,
  superscript: true
})

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Document

Returns a new instance of Document.



14
15
16
17
18
19
20
# File 'lib/dress_code/document.rb', line 14

def initialize(attributes)
  @attributes = attributes
  @path = @attributes[:path]
  @relative_path = @attributes[:relative_path]
  @prose = @attributes[:prose]
  @component = @attributes[:component]
end

Instance Attribute Details

#componentObject

Returns the value of attribute component.



12
13
14
# File 'lib/dress_code/document.rb', line 12

def component
  @component
end

#pathObject

Returns the value of attribute path.



12
13
14
# File 'lib/dress_code/document.rb', line 12

def path
  @path
end

#proseObject

Returns the value of attribute prose.



12
13
14
# File 'lib/dress_code/document.rb', line 12

def prose
  @prose
end

#relative_pathObject

Returns the value of attribute relative_path.



12
13
14
# File 'lib/dress_code/document.rb', line 12

def relative_path
  @relative_path
end

Instance Method Details

#to_htmlObject



22
23
24
# File 'lib/dress_code/document.rb', line 22

def to_html
  MD.render(@prose)
end