Skip to content

Commit

Permalink
refactor: buffer#empty?
Browse files Browse the repository at this point in the history
  • Loading branch information
iberianpig committed Jan 29, 2024
1 parent e2873b3 commit ffa818b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
5 changes: 5 additions & 0 deletions lib/fusuma/plugin/buffers/buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ def buffer(event)
def clear_expired(current_time: Time.now)
end

# @return [TrueClass, FalseClass]
def empty?
@events.empty?
end

# clear buffer
def clear
@events.clear
Expand Down
4 changes: 0 additions & 4 deletions lib/fusuma/plugin/buffers/gesture_buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,10 +127,6 @@ def gesture
@events.last.record.gesture
end

def empty?
@events.empty?
end

def select_by_events(&block)
return enum_for(:select_by_events) unless block

Expand Down
4 changes: 0 additions & 4 deletions lib/fusuma/plugin/buffers/timer_buffer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,6 @@ def clear_expired(current_time: Time.now)
@events.delete(e)
end
end

def empty?
@events.empty?
end
end
end
end
Expand Down

0 comments on commit ffa818b

Please sign in to comment.