Skip to content

Commit

Permalink
memoize note_store and add regex to split
Browse files Browse the repository at this point in the history
  • Loading branch information
bencornelis committed Sep 15, 2015
1 parent 36d4f85 commit c6840d2
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/models/agents/evernote_agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -157,16 +157,15 @@ def check
end

memory[:last_checked_at] = Time.now.to_i * 1000
save!
end
end

private

def note_params(options)
params = interpolated(options)[:note]
errors.add(:base, "only one notebook allowed") unless params[:notebook].to_s.split(", ") == 1
params[:tagNames] = params[:tagNames].to_s.split(", ")
errors.add(:base, "only one notebook allowed") unless params[:notebook].to_s.split(/\s*,\s*/) == 1
params[:tagNames] = params[:tagNames].to_s.split(/\s*,\s*/)
params
end

Expand All @@ -175,7 +174,7 @@ def evernote_note_store
end

def note_store
NoteStore.new(evernote_note_store)
@note_store ||= NoteStore.new(evernote_note_store)
end

# wrapper for evernote api NoteStore
Expand Down

0 comments on commit c6840d2

Please sign in to comment.