Module: Brief::Model::AccessorMethods
- Defined in:
- lib/brief/model.rb
Instance Method Summary
collapse
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(meth, *args, &block) ⇒ Object
52
53
54
55
56
57
58
59
60
61
62
|
# File 'lib/brief/model.rb', line 52
def method_missing(meth, *args, &block)
if args.empty?
if document.respond_to?(meth)
document.send(meth)
else
document.data && document.data.key?(meth) ? data[meth] : .send(meth)
end
else
super
end
end
|
Instance Method Details
#content ⇒ Object
44
45
46
|
# File 'lib/brief/model.rb', line 44
def content
document.content
end
|
#data ⇒ Object
40
41
42
|
# File 'lib/brief/model.rb', line 40
def data
document.data || {}.to_mash
end
|
#document_title ⇒ Object
32
33
34
35
36
37
38
|
# File 'lib/brief/model.rb', line 32
def document_title
data.try(:[], :title) ||
.try(:title) ||
path.basename.to_s
.gsub(/\.html.md/,'')
.gsub(/\.md/,'')
end
|
#exists? ⇒ Boolean
64
65
66
|
# File 'lib/brief/model.rb', line 64
def exists?
document && document.path && document.path.exist?
end
|