evertils 1.0.7 → 1.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6ea9f2ec96c84226c2edc6b8f337773f90c38a0cd7d02cce0c9badb97cfd78a8
4
- data.tar.gz: '08d68089270ff2ce2a94c0590b3a9c6e005c34559990ebef19399c383b9c9167'
3
+ metadata.gz: 52e6a69464d4e124f2e77134b249c4a078ff921929355f95cd0c823453fa1c88
4
+ data.tar.gz: 10aa26578c12a747fd026040259bf26ff88a858f220c7e52c6e78fe288e3be53
5
5
  SHA512:
6
- metadata.gz: 11a69dd8ba32a69adfcc55989d983aac64c36f956b32178f3fef89b595e8bb5687b96462bf12338d597ba7824cd7e84f378c7096b416a247dd4d08aeb8fc8347
7
- data.tar.gz: e701ef3f9605b24dbf5fbf3bf9210b7a41e9dbfebd8ec06c50847fb88caf9b9abb41f086944869f6b6ac4c01c669365665e26bda49b212d9b59760f51872765d
6
+ metadata.gz: 62f26f68ffa20afd0aa71b606e6541963b4522557c109e43cefdcc16c9ddee8f4e6a18b9e74f72ff7aa308bc0346f03948197a5bd269e34ca12466c323b54af5
7
+ data.tar.gz: 5e9d84b4e561cc1ec482d3c1cb86c79ab86772aade652c76ad4298117e071681db8a6dc332455bab471d9a2b83d0d11bf743024e9a89810702342dad67637091
@@ -60,7 +60,6 @@ module Evertils
60
60
  @method = command
61
61
  elsif is_a? Evertils::Controller::Render
62
62
  @method = :from_file
63
- @request.param = config
64
63
  else
65
64
  raise NoMethodError, "Invalid method: #{command}"
66
65
  end
@@ -3,26 +3,19 @@
3
3
  module Evertils
4
4
  module Controller
5
5
  class Render < Controller::Base
6
- def from_file(config)
7
- @config = config.translate_placeholders.pluck(
8
- :title,
9
- :title_format,
10
- :notebook,
11
- :path,
12
- :action,
13
- :tags
14
- )
6
+ def from_file
7
+ set_allowed_fields
15
8
 
16
9
  return Notify.warning("Note already exists\n- #{@link}") if note_exists?
17
10
 
18
11
  Notify.info 'Note not found, creating a new one'
19
12
 
20
- execute_action(@config[:action])
13
+ execute_action(@allowed_fields[:action])
21
14
  end
22
15
 
23
16
  def note_exists?
24
17
  helper = Evertils::Helper.load('Note')
25
- note = helper.wait_for_by_title(@config[:title], @config[:notebook], 3)
18
+ note = helper.wait_for_by_title(@allowed_fields[:title], @allowed_fields[:notebook], 3)
26
19
  @link = helper.external_url_for(note.entity) unless note.entity.nil?
27
20
 
28
21
  note.exists?
@@ -32,15 +25,28 @@ module Evertils
32
25
  case action
33
26
  when nil
34
27
  Notify.info 'Action not provided, creation new note...'
35
- Action::Create.new(@config)
28
+ Action::Create.new(@allowed_fields)
36
29
  when 'create'
37
- Action::Create.new(@config)
30
+ Action::Create.new(@allowed_fields)
38
31
  when 'duplicate_previous'
39
- Action::DuplicatePrevious.new(@config)
32
+ Action::DuplicatePrevious.new(@allowed_fields)
40
33
  else
41
34
  Action::Default.new(action: action)
42
35
  end
43
36
  end
37
+
38
+ private
39
+
40
+ def set_allowed_fields
41
+ @allowed_fields = config.translate_placeholders.pluck(
42
+ :title,
43
+ :title_format,
44
+ :notebook,
45
+ :path,
46
+ :action,
47
+ :tags
48
+ )
49
+ end
44
50
  end
45
51
  end
46
52
  end
@@ -1,3 +1,3 @@
1
1
  module Evertils
2
- VERSION = '1.0.7'.freeze
2
+ VERSION = '1.0.8'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: evertils
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.7
4
+ version: 1.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryan Priebe