repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/events/event_spec.rb | spec/fusuma/plugin/events/event_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/events/event"
module Fusuma
module Plugin
module Events
RSpec.describe Event do
let(:event) { Event.new(**args) }
let(:args) { {tag: "text", record: "dummy_text"} }
before {
allow(Records::R... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/events/records/record_spec.rb | spec/fusuma/plugin/events/records/record_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/events/records/record"
module Fusuma
module Plugin
module Events
module Records
RSpec.describe Record do
before {
allow(Record).to receive(:inherited) # disable autoload
stub_const("D... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/events/records/gesture_record_spec.rb | spec/fusuma/plugin/events/records/gesture_record_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/events/records/gesture_record"
module Fusuma
module Plugin
module Events
module Records
RSpec.describe GestureRecord do
let(:record) do
described_class.new(status: "updating",
gestu... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/events/records/text_record_spec.rb | spec/fusuma/plugin/events/records/text_record_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/events/records/text_record"
module Fusuma
module Plugin
module Events
module Records
RSpec.describe TextRecord do
let(:record) { described_class.new("this is dummy") }
describe "#type" do
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/filters/filter_spec.rb | spec/fusuma/plugin/filters/filter_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/config"
require "./lib/fusuma/plugin/filters/filter"
require "./lib/fusuma/plugin/events/event"
module Fusuma
module Plugin
module Filters
class DummyFilter < Filter
DEFAULT_SOURCE = "dummy_input"
def config_param_... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/filters/libinput_device_filter_spec.rb | spec/fusuma/plugin/filters/libinput_device_filter_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/config"
require "./lib/fusuma/plugin/filters/libinput_device_filter"
require "./lib/fusuma/plugin/events/event"
module Fusuma
module Plugin
module Filters
RSpec.describe LibinputDeviceFilter do
before do
@filter =... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/detectors/swipe_detector_spec.rb | spec/fusuma/plugin/detectors/swipe_detector_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/detectors/swipe_detector"
require "./lib/fusuma/plugin/buffers/gesture_buffer"
require "./lib/fusuma/plugin/events/records/gesture_record"
require "./lib/fusuma/config"
module Fusuma
module Plugin
module Detectors
RSpec.desc... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/detectors/rotate_detector_spec.rb | spec/fusuma/plugin/detectors/rotate_detector_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/detectors/rotate_detector"
require "./lib/fusuma/plugin/buffers/gesture_buffer"
require "./lib/fusuma/plugin/events/event"
require "./lib/fusuma/config"
module Fusuma
module Plugin
module Detectors
RSpec.describe RotateDetec... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/detectors/hold_detector_spec.rb | spec/fusuma/plugin/detectors/hold_detector_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/detectors/hold_detector"
require "./lib/fusuma/plugin/buffers/gesture_buffer"
require "./lib/fusuma/plugin/events/records/gesture_record"
require "./lib/fusuma/config"
require "./lib/fusuma/plugin/inputs/timer_input"
module Fusuma
mod... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/detectors/dummy_detector.rb | spec/fusuma/plugin/detectors/dummy_detector.rb | # frozen_string_literal: true
require "./lib/fusuma/plugin/detectors/detector"
require "./lib/fusuma/plugin/buffers/buffer"
require "./lib/fusuma/plugin/events/records/index_record"
module Fusuma
module Plugin
module Detectors
class DummyDetector < Detector
# @param buffers [Array<Buffers::Buffer>... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/detectors/detector_spec.rb | spec/fusuma/plugin/detectors/detector_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/events/event"
require "./lib/fusuma/plugin/detectors/detector"
require "./lib/fusuma/config"
require_relative "../buffers/dummy_buffer"
require_relative "dummy_detector"
module Fusuma
module Plugin
module Detectors
RSpec.des... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/detectors/pinch_detector_spec.rb | spec/fusuma/plugin/detectors/pinch_detector_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/detectors/pinch_detector"
require "./lib/fusuma/plugin/buffers/gesture_buffer"
require "./lib/fusuma/plugin/events/event"
require "./lib/fusuma/config"
module Fusuma
module Plugin
module Detectors
RSpec.describe PinchDetecto... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/inputs/libinput_command_input_spec.rb | spec/fusuma/plugin/inputs/libinput_command_input_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/inputs/libinput_command_input"
module Fusuma
module Plugin
module Inputs
RSpec.describe LibinputCommandInput do
let(:input) { described_class.new }
describe "#io" do
before do
@dummy_io ... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/inputs/timer_input_spec.rb | spec/fusuma/plugin/inputs/timer_input_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/inputs/timer_input"
module Fusuma
module Plugin
module Inputs
RSpec.describe TimerInput do
before do
@dummy_read = StringIO.new("dummy_read")
@dummy_write = StringIO.new("dummy_write")
@i... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/inputs/input_spec.rb | spec/fusuma/plugin/inputs/input_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/inputs/input"
module Fusuma
module Plugin
module Inputs
RSpec.describe Input do
let(:input) { described_class.new }
describe "#io" do
subject { input.io { "dummy" } }
it { expect { subject... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/parsers/libinput_gesture_parser_spec.rb | spec/fusuma/plugin/parsers/libinput_gesture_parser_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/parsers/parser"
require "./lib/fusuma/plugin/events/event"
require "./lib/fusuma/plugin/inputs/input"
module Fusuma
module Plugin
module Parsers
RSpec.describe LibinputGestureParser do
let(:parser) { LibinputGesturePa... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/plugin/parsers/parser_spec.rb | spec/fusuma/plugin/parsers/parser_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/plugin/parsers/parser"
require "./lib/fusuma/plugin/events/event"
module Fusuma
module Plugin
module Parsers
class DummyParser < Parser
DEFAULT_SOURCE = "dummy_input"
end
RSpec.describe Parser do
let(:pa... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/spec/fusuma/config/searcher_spec.rb | spec/fusuma/config/searcher_spec.rb | # frozen_string_literal: true
require "spec_helper"
require "./lib/fusuma/config"
require "./lib/fusuma/config/searcher"
# spec for Config
module Fusuma
RSpec.describe Config::Searcher do
around do |example|
ConfigHelper.load_config_yml = <<~CONFIG
swipe:
3:
left:
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma.rb | lib/fusuma.rb | # frozen_string_literal: true
require_relative "fusuma/version"
require_relative "fusuma/multi_logger"
require_relative "fusuma/config"
require_relative "fusuma/environment"
require_relative "fusuma/device"
require_relative "fusuma/plugin/manager"
# this is top level module
module Fusuma
# main class
class Runner... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/version.rb | lib/fusuma/version.rb | # frozen_string_literal: true
module Fusuma
VERSION = "3.10.0"
end
| ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/string_support.rb | lib/fusuma/string_support.rb | # frozen_string_literal: true
# support camerize and underscore
class String
def camelize
split("_").map(&:capitalize).join
end
#: () -> String
def underscore
gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
.gsub("::", "/")
.tr("-", "_")
.downcase
end... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/environment.rb | lib/fusuma/environment.rb | # frozen_string_literal: true
require_relative "version"
require_relative "libinput_command"
require_relative "multi_logger"
module Fusuma
# Output Environment information
class Environment
class << self
#: () -> void
def dump_information
MultiLogger.info "---------------------------------... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/multi_logger.rb | lib/fusuma/multi_logger.rb | # frozen_string_literal: true
require "logger"
require "singleton"
# module as namespace
module Fusuma
# logger separate between stdout and strerr
class MultiLogger < Logger
include Singleton
attr_reader :err_logger
attr_accessor :debug_mode
class << self
attr_writer :filepath
#: (u... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/hash_support.rb | lib/fusuma/hash_support.rb | # frozen_string_literal: true
# @rbs generic unchecked out K
# @rbs generic unchecked out V
class Hash
# activesupport-5.2.0/lib/active_support/core_ext/hash/deep_merge.rb
def deep_merge(other_hash, &block)
dup.deep_merge!(other_hash, &block)
end
# Same as +deep_merge+, but modifies +self+.
def deep_mer... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/libinput_command.rb | lib/fusuma/libinput_command.rb | # frozen_string_literal: true
require "open3"
module Fusuma
# Execute libinput command
class LibinputCommand
#: (?libinput_options: Array[String], ?commands: Hash[untyped, untyped]) -> void
def initialize(libinput_options: [], commands: {})
@libinput_command = commands[:libinput_command]
@debu... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/custom_process.rb | lib/fusuma/custom_process.rb | # frozen_string_literal: true
require_relative "string_support"
module Fusuma
# Rename process
module CustomProcess
attr_writer :proctitle
#: () -> Array[untyped]
def child_pids
@child_pids ||= []
end
#: () { () -> void } -> nil
def fork
pid = Process.fork do
Process.... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/config.rb | lib/fusuma/config.rb | # frozen_string_literal: true
require_relative "multi_logger"
require_relative "config/index"
require_relative "config/searcher"
require_relative "config/yaml_duplication_checker"
require_relative "plugin/manager"
require_relative "hash_support"
require "singleton"
require "yaml"
# module as namespace
module Fusuma
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/device.rb | lib/fusuma/device.rb | # frozen_string_literal: true
require_relative "multi_logger"
require "fusuma/plugin/inputs/libinput_command_input"
module Fusuma
# detect input device
class Device
attr_reader :id, :name, :capabilities, :available
#: (?id: nil | String, ?name: nil | String, ?capabilities: nil, ?available: nil | bool) ->... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/base.rb | lib/fusuma/plugin/base.rb | # frozen_string_literal: true
require_relative "manager"
require_relative "../config"
require_relative "../custom_process"
module Fusuma
module Plugin
# Create a Plugin Class with extending this class
class Base
# when inherited from subclass
def self.inherited(subclass)
super
l... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/manager.rb | lib/fusuma/plugin/manager.rb | # frozen_string_literal: true
require_relative "../multi_logger"
require_relative "../string_support"
module Fusuma
module Plugin
# Manage Fusuma plugins
class Manager
#: (Class) -> void
def initialize(plugin_class)
@plugin_class = plugin_class
end
#: () -> Array[untyped]
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/executors/command_executor.rb | lib/fusuma/plugin/executors/command_executor.rb | # frozen_string_literal: true
require_relative "executor"
module Fusuma
module Plugin
module Executors
# Exector plugin
class CommandExecutor < Executor
# Executor parameter on config.yml
# @return [Array<Symbol>]
def execute_keys
[:command]
end
#: ... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/executors/executor.rb | lib/fusuma/plugin/executors/executor.rb | # frozen_string_literal: true
require_relative "../base"
module Fusuma
module Plugin
# executor class
module Executors
# Inherite this base
class Executor < Base
BASE_ONESHOT_INTERVAL = 0.3
BASE_REPEAT_INTERVAL = 0.1
# Executor parameter on config.yml
# @return [... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/buffers/timer_buffer.rb | lib/fusuma/plugin/buffers/timer_buffer.rb | # frozen_string_literal: true
require_relative "buffer"
module Fusuma
module Plugin
module Buffers
# manage events and generate command
class TimerBuffer < Buffer
DEFAULT_SOURCE = "timer_input"
DEFAULT_SECONDS_TO_KEEP = 3
def config_param_types
{
source... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/buffers/gesture_buffer.rb | lib/fusuma/plugin/buffers/gesture_buffer.rb | # frozen_string_literal: true
require_relative "buffer"
module Fusuma
module Plugin
module Buffers
# manage events and generate command
class GestureBuffer < Buffer
CacheEntry = Struct.new(:checked, :value)
DEFAULT_SOURCE = "libinput_gesture_parser"
DEFAULT_SECONDS_TO_KEEP = ... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/buffers/buffer.rb | lib/fusuma/plugin/buffers/buffer.rb | # frozen_string_literal: true
require_relative "../base"
module Fusuma
module Plugin
module Buffers
# buffer events and output
class Buffer < Base
#: (*nil | Array[untyped]) -> void
def initialize(*args)
super()
@events = Array.new(*args)
end
attr... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/events/event.rb | lib/fusuma/plugin/events/event.rb | # frozen_string_literal: true
require_relative "../base"
require_relative "records/record"
require_relative "records/text_record"
module Fusuma
module Plugin
module Events
# Event format
class Event < Base
attr_reader :time
attr_accessor :tag #: String
attr_accessor :record #... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/events/records/record.rb | lib/fusuma/plugin/events/records/record.rb | # frozen_string_literal: true
require_relative "../../base"
module Fusuma
module Plugin
module Events
module Records
# Record
# @abstract Subclass and override {#type} to implement
class Record < Base
# @return [Symbol]
#: () -> nil
def type
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/events/records/gesture_record.rb | lib/fusuma/plugin/events/records/gesture_record.rb | # frozen_string_literal: true
require_relative "text_record"
module Fusuma
module Plugin
module Events
module Records
# Gesture Record
class GestureRecord < Record
# define gesture format
attr_reader :status, :gesture, :finger, :delta
Delta = Struct.new(
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/events/records/text_record.rb | lib/fusuma/plugin/events/records/text_record.rb | # frozen_string_literal: true
require_relative "record"
module Fusuma
module Plugin
module Events
module Records
# Default Record
class TextRecord < Record
# @param text [String]
#: (String) -> void
def initialize(text)
super()
@text = ... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/events/records/context_record.rb | lib/fusuma/plugin/events/records/context_record.rb | # frozen_string_literal: true
module Fusuma
module Plugin
module Events
module Records
# Context Record
class ContextRecord < Record
# define gesture format
attr_reader :name, :value
# @param name [#to_sym]
# @param value [String]
def initi... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/events/records/index_record.rb | lib/fusuma/plugin/events/records/index_record.rb | # frozen_string_literal: true
module Fusuma
module Plugin
module Events
module Records
# Vector Record
# have index
class IndexRecord < Record
# define gesture format
attr_accessor :index
attr_reader :position, :trigger, :args
# @param [Confi... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/filters/filter.rb | lib/fusuma/plugin/filters/filter.rb | # frozen_string_literal: true
require_relative "../base"
module Fusuma
module Plugin
module Filters
# Filter to keep/discard events from input plugin
class Filter < Base
# Filter input event
# @param event [Event]
# @return [Event] when keeping event
# @return [NilCla... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/filters/libinput_device_filter.rb | lib/fusuma/plugin/filters/libinput_device_filter.rb | # frozen_string_literal: true
require_relative "filter"
require_relative "../../device"
module Fusuma
module Plugin
module Filters
# Filter device log
class LibinputDeviceFilter < Filter
DEFAULT_SOURCE = "libinput_command_input"
#: () -> Hash[Symbol, Array[Class] | Class]
de... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/detectors/hold_detector.rb | lib/fusuma/plugin/detectors/hold_detector.rb | # frozen_string_literal: true
require_relative "detector"
require_relative "../inputs/timer_input"
module Fusuma
module Plugin
module Detectors
# Detect Hold gesture
class HoldDetector < Detector
SOURCES = %w[gesture timer].freeze
BUFFER_TYPE = "gesture"
GESTURE_RECORD_TYPE =... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/detectors/swipe_detector.rb | lib/fusuma/plugin/detectors/swipe_detector.rb | # frozen_string_literal: true
require_relative "detector"
module Fusuma
module Plugin
module Detectors
class SwipeDetector < Detector
SOURCES = ["gesture"].freeze
BUFFER_TYPE = "gesture"
GESTURE_RECORD_TYPE = "swipe"
FINGERS = [3, 4].freeze
BASE_THRESHOLD = 25
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/detectors/pinch_detector.rb | lib/fusuma/plugin/detectors/pinch_detector.rb | # frozen_string_literal: true
require_relative "detector"
module Fusuma
module Plugin
module Detectors
class PinchDetector < Detector
SOURCES = ["gesture"].freeze
BUFFER_TYPE = "gesture"
GESTURE_RECORD_TYPE = "pinch"
FINGERS = [2, 3, 4].freeze
BASE_THRESHOLD = 1.3
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/detectors/detector.rb | lib/fusuma/plugin/detectors/detector.rb | # frozen_string_literal: true
require_relative "../base"
require_relative "../events/event"
module Fusuma
module Plugin
module Detectors
# Inherite this base
class Detector < Base
def self.type(tag_name)
tag_name.gsub("_detector", "")
end
#: (*nil) -> void
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/detectors/rotate_detector.rb | lib/fusuma/plugin/detectors/rotate_detector.rb | # frozen_string_literal: true
require_relative "detector"
module Fusuma
module Plugin
module Detectors
class RotateDetector < Detector
SOURCES = ["gesture"].freeze
BUFFER_TYPE = "gesture"
GESTURE_RECORD_TYPE = "pinch"
FINGERS = [2, 3, 4].freeze
BASE_THRESHOLD = 0.5... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/inputs/libinput_command_input.rb | lib/fusuma/plugin/inputs/libinput_command_input.rb | # frozen_string_literal: true
require_relative "../../libinput_command"
require_relative "input"
module Fusuma
module Plugin
module Inputs
# libinput commands wrapper
class LibinputCommandInput < Input
#: () -> Hash[Symbol, Array[Class]]
def config_param_types
{
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/inputs/input.rb | lib/fusuma/plugin/inputs/input.rb | # frozen_string_literal: true
require_relative "../base"
require_relative "../events/event"
module Fusuma
module Plugin
module Inputs
# Inherite this base
# @abstract Subclass and override {#io} to implement
class Input < Base
#: (*nil) -> void
def initialize(*args)
s... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/inputs/timer_input.rb | lib/fusuma/plugin/inputs/timer_input.rb | # frozen_string_literal: true
require_relative "input"
require "timeout"
module Fusuma
module Plugin
module Inputs
# libinput commands wrapper
class TimerInput < Input
include Singleton
DEFAULT_INTERVAL = 5
EPSILON_TIME = 0.02
def config_param_types
{
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/parsers/parser.rb | lib/fusuma/plugin/parsers/parser.rb | # frozen_string_literal: true
require_relative "../base"
module Fusuma
module Plugin
module Parsers
# Parser change record and tag in event
# Inherite this base class
class Parser < Base
# Parse Event and convert Record and Tag
# if `#parse_record` return nil, this method will ... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/plugin/parsers/libinput_gesture_parser.rb | lib/fusuma/plugin/parsers/libinput_gesture_parser.rb | # frozen_string_literal: true
require_relative "../events/records/record"
require_relative "../events/records/gesture_record"
require_relative "../../libinput_command"
module Fusuma
module Plugin
module Parsers
# parse libinput and generate gesture record
class LibinputGestureParser < Parser
... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/config/index.rb | lib/fusuma/config/index.rb | # frozen_string_literal: true
# Index for searching value from config.yml
module Fusuma
class Config
# index for config.yml
class Index
#: (Array[untyped] | String | Symbol | Integer) -> void
def initialize(keys)
case keys
when Array
@keys = []
@cache_key = key... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/config/searcher.rb | lib/fusuma/config/searcher.rb | # frozen_string_literal: true
# Index for searching value from config.yml
module Fusuma
class Config
# Search config.yml
class Searcher
#: () -> void
def initialize
@cache = {}
end
# @param index [Index]
# @param location [Hash]
# @return [NilClass]
# @retur... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
iberianpig/fusuma | https://github.com/iberianpig/fusuma/blob/789804bc5ab68a1eff20699e0cc138b7e2014a62/lib/fusuma/config/yaml_duplication_checker.rb | lib/fusuma/config/yaml_duplication_checker.rb | # frozen_string_literal: true
require "yaml"
module Fusuma
class Config
# ref: https://github.com/rubocop-hq/rubocop/blob/97e4ffc8a71e9e5239a927c6a534dfc1e0da917f/lib/rubocop/yaml_duplication_checker.rb
# Find duplicated keys from YAML.
# steep:ignore:start
module YAMLDuplicationChecker
#: (St... | ruby | MIT | 789804bc5ab68a1eff20699e0cc138b7e2014a62 | 2026-01-04T15:48:35.485710Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/benchmark/slim/run-benchmarks.rb | benchmark/slim/run-benchmarks.rb | #!/usr/bin/env ruby
=begin
The MIT License
Copyright (c) 2010 - 2015 Slim Team
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/benchmark/slim/context.rb | benchmark/slim/context.rb | class Context
def header
'Colors'
end
def item
[ { name: 'red', current: true, url: '#red' },
{ name: 'green', current: false, url: '#green' },
{ name: 'blue', current: false, url: '#blue' } ]
end
end
| ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/benchmark/utils/benchmark_ips_extension.rb | benchmark/utils/benchmark_ips_extension.rb | # Monkey patch to show milliseconds
module Benchmark
module IPS
class Report
module EntryExtension
def body
return super if Benchmark::IPS.options[:format] != :human
left = "%s i/s (%1.3fms)" % [Helpers.scale(ips), (1000.0 / ips)]
iters = Helpers.scale(@iterations)
... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/benchmark/ext/build_id.rb | benchmark/ext/build_id.rb | #!/usr/bin/env ruby
require 'bundler/setup'
require 'haml'
require 'benchmark/ips'
require_relative '../utils/benchmark_ips_extension'
Benchmark.ips do |x|
x.report("Haml::AB.build_id") { Haml::AttributeBuilder.build_id(true, "book", %w[content active]) }
x.compare!
end
| ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/benchmark/ext/build_data.rb | benchmark/ext/build_data.rb | #!/usr/bin/env ruby
require 'bundler/setup'
require 'haml'
require 'benchmark/ips'
require_relative '../utils/benchmark_ips_extension'
h = { 'user' => { id: 1234, name: 'k0kubun' }, book_id: 5432 }
Benchmark.ips do |x|
quote = "'"
x.report("Haml.build_data") { Haml::AttributeBuilder.build_data(true, quote, h) }
... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/benchmark/dynamic_merger/benchmark.rb | benchmark/dynamic_merger/benchmark.rb | # Original: https://github.com/amatsuda/string_template/blob/master/benchmark.rb
require 'benchmark_driver'
Benchmark.driver(repeat_count: 8) do |x|
x.prelude %{
require 'rails'
require 'action_view'
require 'string_template'
StringTemplate::Railtie.run_initializers
require 'haml'
Haml::Railt... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/benchmark/etc/real_sample.rb | benchmark/etc/real_sample.rb | def render(*)
'<div class="render"></div>'
end
def link_to(a, b, *c)
"<a href='" << b << ">".freeze << a << '</div>'.freeze
end
def image_tag(*)
'<img src="https://github.com/favicon.ico" />'
end
| ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
require 'unindent'
require 'bundler/setup'
require 'minitest/autorun'
require 'action_pack'
require 'action_controller'
require 'action_view'
require 'rails'
require 'haml'
# Protect Minitest from Rails' Minitest plugin: https://github.com/rails/rails/pull/19571
ENV['BACKTRACE'] ||= '1'... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/error_test.rb | test/haml/error_test.rb | # frozen_string_literal: true
describe Haml::Engine do
describe 'Error' do
it 'raises an error when Haml::Parser is used independently' do
assert_raises(Haml::Error) do
Haml::Parser.new({}).call("%body\n %div\n %p")
end
end
end
describe 'SyntaxError' do
it 'raises on runt... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/optimization_test.rb | test/haml/optimization_test.rb | # frozen_string_literal: true
require_relative '../test_helper'
describe 'optimization' do
def compiled_code(haml)
Haml::Engine.new.call(haml)
end
describe 'static analysis' do
it 'renders static value for href statically' do
haml = %|%a{ href: 1 }|
assert_equal true, compiled_code(haml).in... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/template_test.rb | test/haml/template_test.rb | # frozen_string_literal: true
require 'test_helper'
require 'haml/mocks/article'
require 'action_pack/version'
require 'haml/rails_template'
module Haml::RailsHelpers
def test_partial(name, locals = {})
Haml::Template.new { File.read(File.join(TemplateTest::TEMPLATE_PATH, "_#{name}.haml")) }.render(self, local... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/line_number_test.rb | test/haml/line_number_test.rb | # frozen_string_literal: true
require_relative '../test_helper'
describe Haml::Engine do
include RenderHelper
describe 'script' do
it 'renders optimized script' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
1
2
HTML
= '1'
= __LINE__
HAML
end
i... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/dynamic_merger_test.rb | test/haml/dynamic_merger_test.rb | # frozen_string_literal: true
describe Haml::DynamicMerger do
describe '#call' do
def assert_compile(expected, input)
actual = Haml::DynamicMerger.new.compile(input)
assert_equal expected, actual
end
def assert_noop(input)
actual = Haml::DynamicMerger.new.compile(input)
assert_eq... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters_test.rb | test/haml/filters_test.rb | # frozen_string_literal: true
require 'test_helper'
class FiltersTest < Haml::TestCase
test "should be registered as filters when including Haml::Filters::Base" do; skip
begin
refute Haml::Filters.defined.has_key? "bar"
Module.new {def self.name; "Foo::Bar"; end; include Haml::Filters::Base}
a... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/helper_test.rb | test/haml/helper_test.rb | # frozen_string_literal: true
require 'test_helper'
require "active_model/naming"
class FormModel
extend ActiveModel::Naming
end
class HelperTest < Haml::TestCase
TEXT_AREA_CONTENT_REGEX = /<(textarea)[^>]*>\n(.*?)<\/\1>/im
Post = Struct.new('Post', :body, :error_field, :errors)
class PostErrors
def on(... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/tilt_test.rb | test/haml/tilt_test.rb | # frozen_string_literal: true
describe Tilt::HamlTemplate do
describe '#render' do
def suppress_warning(&block)
begin
$VERBOSE, verbose = nil, $VERBOSE
block.call
ensure
$VERBOSE = verbose
end
end
it 'works normally' do
template = suppress_warning { Tilt::... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/rails_template_test.rb | test/haml/rails_template_test.rb | # frozen_string_literal: true
# Explicitly requiring rails_template because rails initializers is not executed here.
require 'haml/rails_template'
describe Haml::RailsTemplate do
def render(haml)
ActionView::Template.register_template_handler(:haml, Haml::RailsTemplate.new)
base = Class.new(ActionView::Base... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/helpers_test.rb | test/haml/helpers_test.rb | # frozen_string_literal: true
describe Haml::Helpers do
describe '.preserve' do
it 'works without block' do
result = Haml::Helpers.preserve("hello\nworld")
assert_equal 'hello
world', result
end
end
end
| ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/string_splitter_test.rb | test/haml/string_splitter_test.rb | # frozen_string_literal: true
describe Haml::StringSplitter do
describe '.compile' do
def assert_compile(expected, code)
actual = Haml::StringSplitter.compile(code)
assert_equal expected, actual
end
it { assert_compile([], %q|''|) }
it { assert_compile([], %q|""|) }
it { assert_compi... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/cli_test.rb | test/haml/cli_test.rb | # frozen_string_literal: true
require 'haml/cli'
describe Haml::CLI do
describe '#temple' do
def redirect_output
out, $stdout = $stdout, StringIO.new
yield
ensure
$stdout = out
end
it 'does not crash when compiling a tag' do
redirect_output do
f = Tempfile.open('haml... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/attribute_parser_test.rb | test/haml/attribute_parser_test.rb | # frozen_string_literal: true
describe Haml::AttributeParser do
describe '.parse' do
def assert_parse(expected, haml)
actual = Haml::AttributeParser.parse(haml)
if expected.nil?
assert_nil actual
else
assert_equal expected, actual
end
end
it { assert_parse({}, '')... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/ruby_expression_test.rb | test/haml/ruby_expression_test.rb | # frozen_string_literal: true
describe Haml::RubyExpression do
describe '.syntax_error?' do
it { assert_equal(true, Haml::RubyExpression.syntax_error?('{ hash }')) }
it { assert_equal(false, Haml::RubyExpression.syntax_error?('{ a: b }')) }
end
describe '.string_literal?' do
def assert_literal(expe... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine_test.rb | test/haml/engine_test.rb | # frozen_string_literal: true
$:.unshift __dir__
require_relative '../test_helper'
class EngineTest < Haml::TestCase
# A map of erroneous Haml documents to the error messages they should produce.
# The error messages may be arrays;
# if so, the second element should be the line number that should be reported f... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | true |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/haml-spec/ugly_test.rb | test/haml/haml-spec/ugly_test.rb | # frozen_string_literal: true
$:.unshift File.expand_path('../../test', __dir__)
require 'test_helper'
require 'haml'
require 'minitest/autorun'
# This is a spec converted by haml-spec.
# See: https://github.com/haml/haml-spec
class UglyTest < Minitest::Test
HAML_DEFAULT_OPTIONS = { escape_html: true }.freeze
d... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/mocks/article.rb | test/haml/mocks/article.rb | # frozen_string_literal: true
class Article
attr_accessor :id, :title, :body
def initialize
@id, @title, @body = 1, 'Hello', 'World'
end
end | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/javascript_test.rb | test/haml/filters/javascript_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'just renders script tag for empty filter' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
before
<script>
</script>
after
HTML
before
... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/plain_test.rb | test/haml/filters/plain_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'does not escape content without interpolation' do
assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
<script>
HTML
:plain
<script>
HAML
end
it 'does not... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/sass_test.rb | test/haml/filters/sass_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'renders sass filter' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<style>
.users_controller .show_action {
margin: 10px;
padding: 20px; }
</st... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/markdown_test.rb | test/haml/filters/markdown_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'renders markdown filter' do
if /java/ === RUBY_PLATFORM && !system('which pandoc > /dev/null')
skip 'pandoc is required to test :markdown filter'
end
assert_render(<<-HTML.uninden... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/css_test.rb | test/haml/filters/css_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'renders css' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<style>
.foo {
width: 100px;
}
</style>
HTML
:css
.foo {
... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/erb_test.rb | test/haml/filters/erb_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'renders erb filter' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
ok
HTML
:erb
<% if true %>
ok
<% else %>
ng
<% end %>
... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/coffee_test.rb | test/haml/filters/coffee_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'renders coffee filter' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<script>
(function() {
var foo;
foo = function() {
return... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/ruby_test.rb | test/haml/filters/ruby_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
it 'renders ruby filter' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
hello
HTML
:ruby
hello
HAML
end
it 'renders ruby filter' do
assert_render(<<-HTML.unindent, <<-'HAML'.unindent)
&l... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/cdata_test.rb | test/haml/filters/cdata_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'renders cdata' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<![CDATA[
foo bar
]]>
HTML
:cdata
foo bar
HAML
end
it 'parses str... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/filters/scss_test.rb | test/haml/filters/scss_test.rb | # frozen_string_literal: true
describe Haml::Filters do
include RenderHelper
describe '#compile' do
it 'renders scss filter' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<style>
.users_controller .show_action {
margin: 10px;
padding: 20px; }
</st... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/silent_script_test.rb | test/haml/engine/silent_script_test.rb | # frozen_string_literal: true
describe Haml::Engine do
include RenderHelper
describe 'silent script' do
it 'renders nothing' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
HTML
- _ = nil
- _ = 3
- _ = 'foo'
HAML
end
it 'renders silent script' do
a... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/tag_test.rb | test/haml/engine/tag_test.rb | # frozen_string_literal: true
describe Haml::Engine do
include RenderHelper
describe 'tag' do
it 'renders one-line tag' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<span>hello</span>
HTML
%span hello
HAML
end
it 'accepts multi-line =' do
assert_render(... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/attributes_test.rb | test/haml/engine/attributes_test.rb | # frozen_string_literal: true
require_relative '../../test_helper'
describe Haml::Engine do
include RenderHelper
describe 'id attributes' do
describe 'compatilibity' do
# TODO: assert_haml tests nothing since migration to haml repository. Use assert_render instead.
it { assert_haml(%q|#a|) }
... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/old_attribute_test.rb | test/haml/engine/old_attribute_test.rb | # frozen_string_literal: true
require_relative '../../test_helper'
describe Haml::Engine do
include RenderHelper
describe 'old attributes' do
it 'renders attributes' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<span class="foo">bar</span>
HTML
%span{class: 'foo'} bar
... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/indent_test.rb | test/haml/engine/indent_test.rb | # frozen_string_literal: true
describe Haml::Engine do
include RenderHelper
describe 'tab indent' do
it 'accepts tab indentation' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<p>
<a></a>
</p>
HTML
%p
\t%a
HAML
end
it 'accepts N-space i... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/comment_test.rb | test/haml/engine/comment_test.rb | # frozen_string_literal: true
describe Haml::Engine do
include RenderHelper
describe 'comment' do
it 'renders html comment' do
assert_render(%Q|<!-- comments -->\n|, '/ comments')
end
it 'renders intepolation' do
assert_render(%Q|<!-- comments -->\n|, '/ #{"comments"}')
end
it 's... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/doctype_test.rb | test/haml/engine/doctype_test.rb | # frozen_string_literal: true
describe Haml::Engine do
include RenderHelper
describe 'doctype' do
it 'renders html5 doctype' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<!DOCTYPE html>
HTML
!!!
HAML
end
it 'renders xml doctype' do
assert_render(<<-HTML... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/whitespace_test.rb | test/haml/engine/whitespace_test.rb | # frozen_string_literal: true
describe Haml::Engine do
include RenderHelper
describe 'whitespace removal' do
it 'removes outer whitespace by >' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
<span>a</span><span>b</span>
<span>c</span><span>
d
</span><span>
e... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
haml/haml | https://github.com/haml/haml/blob/2417298e12318b699481abf62257259dbc28aa0f/test/haml/engine/script_test.rb | test/haml/engine/script_test.rb | # frozen_string_literal: true
describe Haml::Engine do
include RenderHelper
describe 'script' do
it 'renders one-line script' do
assert_render(<<-HTML.unindent, <<-HAML.unindent)
3
<span>12</span>
HTML
= 1 + 2
%span= 3 * 4
HAML
end
it 'renders dynamic... | ruby | MIT | 2417298e12318b699481abf62257259dbc28aa0f | 2026-01-04T15:48:11.318331Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.