Class: LLRemote::Logi

Inherits:
Object
  • Object
show all
Defined in:
lib/l_l_remote/logi.rb

Overview

LLRemote::Logi is a logi that can be read and saved remotely

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Logi

Initializes a logi.

Options:

  • link = link of the logi (can have different tags for existing logis to update it’s tags)

  • title = the title (optional for existing logi)

  • body = the body (optional for existing logi)



14
15
16
17
18
# File 'lib/l_l_remote/logi.rb', line 14

def initialize(options)
  self.link = options[:link]
  self.title = options[:title]
  self.body = options[:body]
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



4
5
6
# File 'lib/l_l_remote/logi.rb', line 4

def body
  @body
end

Returns the value of attribute link.



4
5
6
# File 'lib/l_l_remote/logi.rb', line 4

def link
  @link
end

#titleObject

Returns the value of attribute title.



4
5
6
# File 'lib/l_l_remote/logi.rb', line 4

def title
  @title
end

Instance Method Details

#reloadObject

Loads the logi with it’s remote data



22
23
24
25
# File 'lib/l_l_remote/logi.rb', line 22

def reload
  entry = LLRemote.load_entry(self.link)
  self.set_from_entry(entry)
end

#saveObject

Saves the logi. It creates it if it doesn’t exist, and updates it if it does.



30
31
32
33
34
35
36
# File 'lib/l_l_remote/logi.rb', line 30

def save
  if self.link =~ /=/
    return self.update
  else
    return self.create
  end
end