diff --git a/lib/fusuma.rb b/lib/fusuma.rb index 11e232b..4fa1299 100644 --- a/lib/fusuma.rb +++ b/lib/fusuma.rb @@ -148,7 +148,7 @@ def detect(buffers) # @return [NilClass] when event is NOT given def merge(events) index_events, context_events = events.partition { |event| event.record.type == :index } - main_events, modifiers = index_events.partition { |event| event.record.mergable? } + main_events, modifiers = index_events.partition { |event| event.record.mergeable? } request_context = context_events.each_with_object({}) do |e, results| results[e.record.name] = e.record.value end diff --git a/lib/fusuma/device.rb b/lib/fusuma/device.rb index 518f7cf..b06dee7 100644 --- a/lib/fusuma/device.rb +++ b/lib/fusuma/device.rb @@ -66,7 +66,7 @@ def fetch_devices line_parser = LineParser.new libinput_command = Plugin::Inputs::LibinputCommandInput.new.command - # note: this libinput command takes a nontrivial amout of time (~200ms) + # note: this libinput command takes a nontrivial amount of time (~200ms) libinput_command.list_devices do |line| line_parser.push(line) end diff --git a/lib/fusuma/libinput_command.rb b/lib/fusuma/libinput_command.rb index 483d67c..8a3e67a 100644 --- a/lib/fusuma/libinput_command.rb +++ b/lib/fusuma/libinput_command.rb @@ -22,7 +22,7 @@ def new_cli_option_available? # @return [String] def version - # versiom_command prints "1.6.3\n" + # version_command prints "1.6.3\n" @version ||= `#{version_command}`.strip end diff --git a/lib/fusuma/plugin/detectors/hold_detector.rb b/lib/fusuma/plugin/detectors/hold_detector.rb index 4fcedf1..ecd9319 100644 --- a/lib/fusuma/plugin/detectors/hold_detector.rb +++ b/lib/fusuma/plugin/detectors/hold_detector.rb @@ -12,7 +12,7 @@ class HoldDetector < Detector BUFFER_TYPE = "gesture" GESTURE_RECORD_TYPE = "hold" - BASE_THERESHOLD = 0.7 + BASE_THRESHOLD = 0.7 def initialize(*args) super(*args) @@ -134,7 +134,7 @@ def threshold(index:) keys_global = Config::Index.new ["threshold", type] config_value = Config.search(keys_specific) || Config.search(keys_global) || 1 - BASE_THERESHOLD * config_value + BASE_THRESHOLD * config_value end end end diff --git a/lib/fusuma/plugin/detectors/pinch_detector.rb b/lib/fusuma/plugin/detectors/pinch_detector.rb index da42d92..7062087 100644 --- a/lib/fusuma/plugin/detectors/pinch_detector.rb +++ b/lib/fusuma/plugin/detectors/pinch_detector.rb @@ -11,7 +11,7 @@ class PinchDetector < Detector GESTURE_RECORD_TYPE = "pinch" FINGERS = [2, 3, 4].freeze - BASE_THERESHOLD = 1.3 + BASE_THRESHOLD = 1.3 # @param buffers [Array] # @return [Events::Event] if event is detected @@ -141,7 +141,7 @@ def threshold(index:) keys_global = Config::Index.new ["threshold", type] config_value = Config.search(keys_specific) || Config.search(keys_global) || 1 - BASE_THERESHOLD * config_value + BASE_THRESHOLD * config_value end end diff --git a/lib/fusuma/plugin/detectors/rotate_detector.rb b/lib/fusuma/plugin/detectors/rotate_detector.rb index 2710b2b..5a91f8e 100644 --- a/lib/fusuma/plugin/detectors/rotate_detector.rb +++ b/lib/fusuma/plugin/detectors/rotate_detector.rb @@ -11,7 +11,7 @@ class RotateDetector < Detector GESTURE_RECORD_TYPE = "pinch" FINGERS = [2, 3, 4].freeze - BASE_THERESHOLD = 0.5 + BASE_THRESHOLD = 0.5 # @param buffers [Array] # @return [Events::Event] if event is detected @@ -126,7 +126,7 @@ def threshold(index:) keys_global = Config::Index.new ["threshold", type] config_value = Config.search(keys_specific) || Config.search(keys_global) || 1 - BASE_THERESHOLD * config_value + BASE_THRESHOLD * config_value end end diff --git a/lib/fusuma/plugin/detectors/swipe_detector.rb b/lib/fusuma/plugin/detectors/swipe_detector.rb index 2422cbb..a02ee6e 100644 --- a/lib/fusuma/plugin/detectors/swipe_detector.rb +++ b/lib/fusuma/plugin/detectors/swipe_detector.rb @@ -11,7 +11,7 @@ class SwipeDetector < Detector GESTURE_RECORD_TYPE = "swipe" FINGERS = [3, 4].freeze - BASE_THERESHOLD = 25 + BASE_THRESHOLD = 25 # @param buffers [Array] # @return [Events::Event] if event is detected @@ -124,7 +124,7 @@ def threshold(index:) keys_global = Config::Index.new ["threshold", type] config_value = Config.search(keys_specific) || Config.search(keys_global) || 1 - BASE_THERESHOLD * config_value + BASE_THRESHOLD * config_value end end diff --git a/lib/fusuma/plugin/events/records/index_record.rb b/lib/fusuma/plugin/events/records/index_record.rb index 88dc250..0b7431d 100644 --- a/lib/fusuma/plugin/events/records/index_record.rb +++ b/lib/fusuma/plugin/events/records/index_record.rb @@ -36,7 +36,7 @@ def type # @return [NilClass] when merge is not succeeded def merge(records:, index: @index) # FIXME: cache - raise "position is NOT body: #{self}" unless mergable? + raise "position is NOT body: #{self}" unless mergeable? if records.empty? if Config.instance.find_execute_key(index) @@ -76,7 +76,7 @@ def trigger_priority end end - def mergable? + def mergeable? @position == :body end end diff --git a/spec/fusuma/config/searcher_spec.rb b/spec/fusuma/config/searcher_spec.rb index ba77206..5ab3ea5 100644 --- a/spec/fusuma/config/searcher_spec.rb +++ b/spec/fusuma/config/searcher_spec.rb @@ -46,7 +46,7 @@ module Fusuma it { expect(Config::Searcher.new.search(index, location: location)).not_to eq "ctrl+plus" } end - context "with Skip condtions" do + context "with Skip conditions" do context "when index includes skippable key" do let(:index) do Config::Index.new [ diff --git a/spec/fusuma/plugin/buffers/gesture_buffer_spec.rb b/spec/fusuma/plugin/buffers/gesture_buffer_spec.rb index 8176076..51ff397 100644 --- a/spec/fusuma/plugin/buffers/gesture_buffer_spec.rb +++ b/spec/fusuma/plugin/buffers/gesture_buffer_spec.rb @@ -170,7 +170,7 @@ module Buffers end end - describe "#slect_by_events" do + describe "#select_by_events" do context "without block" do it { expect(@buffer.select_by_events).to be_a Enumerator } end diff --git a/spec/fusuma/plugin/detectors/hold_detector_spec.rb b/spec/fusuma/plugin/detectors/hold_detector_spec.rb index 6afb775..d911bad 100644 --- a/spec/fusuma/plugin/detectors/hold_detector_spec.rb +++ b/spec/fusuma/plugin/detectors/hold_detector_spec.rb @@ -60,7 +60,7 @@ module Detectors it { expect(@detector.detect([@buffer, @timer_buffer])).to be_a Events::Event } it { expect(@detector.detect([@buffer, @timer_buffer]).record).to be_a Events::Records::IndexRecord } it { expect(@detector.detect([@buffer, @timer_buffer]).record.index).to be_a Config::Index } - it "should detect 3 fingers hold canclled" do + it "should detect 3 fingers hold cancelled" do event = @detector.detect([@buffer, @timer_buffer]) expect(event.record.index.keys.map(&:symbol)).to eq([:hold, 3, :cancelled]) end @@ -86,14 +86,14 @@ module Detectors events = create_hold_events(statuses: %w[begin]) events.each { |event| @buffer.buffer(event) } @time = events.last.time - @timer_buffer.buffer(create_timer_event(time: @time + HoldDetector::BASE_THERESHOLD)) + @timer_buffer.buffer(create_timer_event(time: @time + HoldDetector::BASE_THRESHOLD)) end it { expect(@detector.detect([@buffer, @timer_buffer])).to eq nil } context "with enough holding time" do before do @timer_buffer.clear - @timer_buffer.buffer(create_timer_event(time: @time + HoldDetector::BASE_THERESHOLD + 0.01)) + @timer_buffer.buffer(create_timer_event(time: @time + HoldDetector::BASE_THRESHOLD + 0.01)) end it { expect(@detector.detect([@buffer, @timer_buffer])).to be_a Events::Event } it { expect(@detector.detect([@buffer, @timer_buffer]).record).to be_a Events::Records::IndexRecord }