Class: MarkupModel::ModelFile

Inherits:
Object
  • Object
show all
Defined in:
lib/markup_model/model_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ ModelFile

Returns a new instance of ModelFile.



5
6
7
8
# File 'lib/markup_model/model_file.rb', line 5

def initialize(path)
  @attributes = nil
  @path = path
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



3
4
5
# File 'lib/markup_model/model_file.rb', line 3

def path
  @path
end

Instance Method Details

#attributesObject



10
11
12
13
# File 'lib/markup_model/model_file.rb', line 10

def attributes
  read_attributes
  @attributes
end

#contentObject



15
16
17
18
# File 'lib/markup_model/model_file.rb', line 15

def content
  read_attributes
  @content
end

#idObject



20
21
22
# File 'lib/markup_model/model_file.rb', line 20

def id
  File.basename(path).sub(/\.md$/i, "").sub(/^0*/, "")
end