Class: LocalUnfuddleNotebook::Page
- Inherits:
-
Valuable
- Object
- Valuable
- LocalUnfuddleNotebook::Page
- Defined in:
- lib/local_unfuddle_notebook/page.rb
Instance Method Summary collapse
- #basename ⇒ Object
- #changed? ⇒ Boolean
- #local_attributes ⇒ Object
- #push ⇒ Object
- #remote_attributes ⇒ Object
- #save ⇒ Object
Instance Method Details
#basename ⇒ Object
12 13 14 |
# File 'lib/local_unfuddle_notebook/page.rb', line 12 def basename "#{title.gsub(/\W/, '-')}.yaml".downcase end |
#changed? ⇒ Boolean
16 17 18 |
# File 'lib/local_unfuddle_notebook/page.rb', line 16 def changed? notebook.last_updated_at < local_file.mtime end |
#local_attributes ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/local_unfuddle_notebook/page.rb', line 20 def local_attributes { :body => body, :id => id, :title => title } end |
#push ⇒ Object
28 29 30 |
# File 'lib/local_unfuddle_notebook/page.rb', line 28 def push notebook["/pages/#{id}"].put :page => remote_attributes end |
#remote_attributes ⇒ Object
32 33 34 35 36 37 38 |
# File 'lib/local_unfuddle_notebook/page.rb', line 32 def remote_attributes { :title => title, :body => body, :message => } end |
#save ⇒ Object
40 41 42 |
# File 'lib/local_unfuddle_notebook/page.rb', line 40 def save (Pow(Notebook.local_pages_path)/basename).write(local_attributes.to_yaml) end |