Class: Gitki::Page
- Inherits:
-
Object
- Object
- Gitki::Page
- Defined in:
- lib/gitki.rb
Class Attribute Summary collapse
-
.dir ⇒ Object
readonly
Returns the value of attribute dir.
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw) ⇒ Page
constructor
A new instance of Page.
Constructor Details
#initialize(raw) ⇒ Page
Returns a new instance of Page.
83 84 85 86 |
# File 'lib/gitki.rb', line 83 def initialize(raw) @raw = raw @title, @body = split_title_and_body(raw) end |
Class Attribute Details
.dir ⇒ Object (readonly)
Returns the value of attribute dir.
54 55 56 |
# File 'lib/gitki.rb', line 54 def dir @dir end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
81 82 83 |
# File 'lib/gitki.rb', line 81 def body @body end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
81 82 83 |
# File 'lib/gitki.rb', line 81 def raw @raw end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
81 82 83 |
# File 'lib/gitki.rb', line 81 def title @title end |
Class Method Details
.find(name) ⇒ Object
67 68 69 70 71 72 73 74 |
# File 'lib/gitki.rb', line 67 def find(name) data = store[store_path(name)] if data self.new(data) else nil end end |
.find_all ⇒ Object
59 60 61 62 63 64 65 |
# File 'lib/gitki.rb', line 59 def find_all pages = {} store[dir].to_hash.each do |name, text| pages[name] = self.new(text) end pages end |
.setup(dir) ⇒ Object
55 56 57 |
# File 'lib/gitki.rb', line 55 def setup(dir) @dir = dir end |
.store_path(name) ⇒ Object
76 77 78 |
# File 'lib/gitki.rb', line 76 def store_path(name) File.join(dir, name) end |