Skip to content

Commit

Permalink
chore: fix typos
Browse files Browse the repository at this point in the history
  • Loading branch information
iberianpig committed Jul 5, 2024
1 parent 853405b commit ccb6886
Show file tree
Hide file tree
Showing 11 changed files with 18 additions and 18 deletions.
2 changes: 1 addition & 1 deletion lib/fusuma.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/fusuma/device.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion lib/fusuma/libinput_command.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/fusuma/plugin/detectors/hold_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/fusuma/plugin/detectors/pinch_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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<Buffer>]
# @return [Events::Event] if event is detected
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/fusuma/plugin/detectors/rotate_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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<Buffer>]
# @return [Events::Event] if event is detected
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/fusuma/plugin/detectors/swipe_detector.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ class SwipeDetector < Detector
GESTURE_RECORD_TYPE = "swipe"

FINGERS = [3, 4].freeze
BASE_THERESHOLD = 25
BASE_THRESHOLD = 25

# @param buffers [Array<Buffers::Buffer>]
# @return [Events::Event] if event is detected
Expand Down Expand Up @@ -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

Expand Down
4 changes: 2 additions & 2 deletions lib/fusuma/plugin/events/records/index_record.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -76,7 +76,7 @@ def trigger_priority
end
end

def mergable?
def mergeable?
@position == :body
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/fusuma/config/searcher_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand Down
2 changes: 1 addition & 1 deletion spec/fusuma/plugin/buffers/gesture_buffer_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions spec/fusuma/plugin/detectors/hold_detector_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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 }
Expand Down

0 comments on commit ccb6886

Please sign in to comment.