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 |
|---|---|---|---|---|---|---|---|---|
shiroyasha/factory_bot_instruments | https://github.com/shiroyasha/factory_bot_instruments/blob/8306a388288cc13358463f6666ae836c7e1f0218/lib/factory_bot_instruments/version.rb | lib/factory_bot_instruments/version.rb | module FactoryBotInstruments
VERSION = "1.2.0"
end
| ruby | MIT | 8306a388288cc13358463f6666ae836c7e1f0218 | 2026-01-04T17:51:48.615283Z | false |
shiroyasha/factory_bot_instruments | https://github.com/shiroyasha/factory_bot_instruments/blob/8306a388288cc13358463f6666ae836c7e1f0218/lib/factory_bot_instruments/benchmarking.rb | lib/factory_bot_instruments/benchmarking.rb | module FactoryBotInstruments
module Benchmarking
def benchmark_all(
except: [],
methods: [:create, :build, :build_stubbed],
progress: false)
factories = FactoryBot.factories.map(&:name) - except
report = factories.map do |factory|
puts "Processing #{factory}" if progress
... | ruby | MIT | 8306a388288cc13358463f6666ae836c7e1f0218 | 2026-01-04T17:51:48.615283Z | false |
shiroyasha/factory_bot_instruments | https://github.com/shiroyasha/factory_bot_instruments/blob/8306a388288cc13358463f6666ae836c7e1f0218/lib/factory_bot_instruments/tracing.rb | lib/factory_bot_instruments/tracing.rb | $FACTORY_BOT_INSTRUMENTS_TRACING = false
$FACTORY_BOT_INSTRUMENTS_TRACING_DEPTH = 0
# monkey patch Factory#run
module FactoryBot
class Factory
alias_method :original_run, :run
def run(build_strategy, overrides, &block)
if $FACTORY_BOT_INSTRUMENTS_TRACING
depth = "| " * $FACTORY_BOT_INSTRU... | ruby | MIT | 8306a388288cc13358463f6666ae836c7e1f0218 | 2026-01-04T17:51:48.615283Z | false |
soveran/cargo | https://github.com/soveran/cargo/blob/5559fd122c8e7629e3bb92984d1f1087e96c4ea8/test/foo-1.0.0.rb | test/foo-1.0.0.rb | class Foo
class Bar
class Baz
def qux
"Hello"
end
end
def baz
"Hello"
end
end
def bar
"Hello"
end
end
export(Foo) if defined?(export)
| ruby | MIT | 5559fd122c8e7629e3bb92984d1f1087e96c4ea8 | 2026-01-04T17:51:54.743239Z | false |
soveran/cargo | https://github.com/soveran/cargo/blob/5559fd122c8e7629e3bb92984d1f1087e96c4ea8/test/cargo_test.rb | test/cargo_test.rb | # encoding: UTF-8
require File.join(".", "lib", "cargo")
setup do
unless defined?(Foo1)
Foo1 = import("test/foo-1.0.0")
end
unless defined?(Foo2)
Foo2 = import("test/foo-2.0.0")
end
end
test "Foo is not available" do
assert nil == defined?(Foo)
end
test "Foo1 is a class" do
assert Class == Foo1... | ruby | MIT | 5559fd122c8e7629e3bb92984d1f1087e96c4ea8 | 2026-01-04T17:51:54.743239Z | false |
soveran/cargo | https://github.com/soveran/cargo/blob/5559fd122c8e7629e3bb92984d1f1087e96c4ea8/test/foo-2.0.0.rb | test/foo-2.0.0.rb | class Foo
class Bar
class Baz
def qux
"Hello"
end
end
def baz
"Hello"
end
end
def bar
"Hello"
end
end
export(Foo) if defined?(export)
| ruby | MIT | 5559fd122c8e7629e3bb92984d1f1087e96c4ea8 | 2026-01-04T17:51:54.743239Z | false |
soveran/cargo | https://github.com/soveran/cargo/blob/5559fd122c8e7629e3bb92984d1f1087e96c4ea8/lib/cargo.rb | lib/cargo.rb | module Cargo
VERSION = "0.0.3"
def import(file)
unless file.match(/\.rb$/)
file = "#{file}.rb"
end
load(file, true)
Thread.current[:cargo].tap do
Thread.current[:cargo] = nil
end
end
def export(cargo)
Thread.current[:cargo] = cargo
end
end
extend Cargo
| ruby | MIT | 5559fd122c8e7629e3bb92984d1f1087e96c4ea8 | 2026-01-04T17:51:54.743239Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/test/freezolite_test.rb | test/freezolite_test.rb | require "test_helper"
class FreezeTheListTest < Minitest::Test
if ENV["FREEZOLITE_DISABLED"] == "true"
def test_fixtures_default_behaviour
load File.join(__dir__, "./fixtures/app/name.rb")
result = Name.new + "test"
assert result.end_with?("test")
load File.join(__dir__, "./fixtures/li... | ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
begin
require "debug" unless ENV["CI"]
rescue LoadError
end
$LOAD_PATH.unshift File.expand_path("../lib", __dir__)
require "freezolite"
if ENV["FREEZOLITE_DISABLED"] == "true"
$stdout.puts "Freezolite is disabled"
else
Freezolite.experimental_freeze_constants = true
Freezolite.s... | ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/test/fixtures/app/name_unfrozen.rb | test/fixtures/app/name_unfrozen.rb | # frozen_string_literal: false
# shareable_constant_value: none
class Name
attr_reader :name
NAMES = %w[Alice Bob Charles Diana].freeze
def initialize(name = NAMES.sample)
@name = name
end
def +(other)
@name << " " << other
end
end
| ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/test/fixtures/app/constants.rb | test/fixtures/app/constants.rb | module Constants
ARR = [1, 2, 3]
HASH = {a: 1, b: 2, c: 3}
class SomeClass
end
end
| ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/test/fixtures/app/name.rb | test/fixtures/app/name.rb | class Name
attr_reader :name
NAMES = %w[Alice Bob Charles Diana]
def initialize(name = NAMES.sample)
@name = name
end
def +(other)
@name << " " << other
end
end
| ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/test/fixtures/app/vendor/bundle/gem.rb | test/fixtures/app/vendor/bundle/gem.rb | module VendorGem
CONSTANT = "hot"
end
| ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/test/fixtures/test/name_test.rb | test/fixtures/test/name_test.rb | class NameTest
def self.run
x = "name"
x << " 1"
x << " 2"
x
end
end
| ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/test/fixtures/lib/strings.rb | test/fixtures/lib/strings.rb | module Strings
class << self
def hello
"Hallo"
end
def goodbye
"Auf Wiedersehen"
end
end
end
| ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/lib/freezolite.rb | lib/freezolite.rb | # frozen_string_literal: true
require "freezolite/version"
module Freezolite
class << self
attr_reader :experimental_freeze_constants
def experimental_freeze_constants=(val)
@experimental_freeze_constants = (val == true) ? :literal : val
end
def setup(patterns:, exclude_patterns: nil)
... | ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/lib/freezolite/version.rb | lib/freezolite/version.rb | # frozen_string_literal: true
module Freezolite # :nodoc:
VERSION = "0.6.0"
end
| ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
ruby-next/freezolite | https://github.com/ruby-next/freezolite/blob/79727191a6790f55220975fd53eb86577f9eb5a0/lib/freezolite/auto.rb | lib/freezolite/auto.rb | require "freezolite"
Freezolite.setup(
patterns: [File.join(Dir.pwd, "*.rb")],
exclude_patterns: [File.join(Dir.pwd, "vendor", "*")]
)
| ruby | MIT | 79727191a6790f55220975fd53eb86577f9eb5a0 | 2026-01-04T17:51:52.275829Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/misc/terminal-emoji-width.rb | misc/terminal-emoji-width.rb | #!/usr/bin/env ruby
RULER = "123456789\n"
ABC = "abcdefg\n\n"
puts "1) TEXT-DEFAULT EMOJI"
puts
puts RULER + "โน" + ABC
puts "1B) TEXT-DEFAULT EMOJI + VS16"
puts
puts RULER + "โน๏ธ" + ABC
puts "1C) BASE EMOJI CHARACTER + MODIFIER"
puts
puts RULER + "๐๐ฝ" + ABC
puts "1D) MODIFIER IN ISOLATION"
puts
puts RULER + "Z๏ฟฝ... | ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/spec/display_width_spec.rb | spec/display_width_spec.rb | # frozen_string_literal: true
require_relative '../lib/unicode/display_width/string_ext'
describe 'Unicode::DisplayWidth.of' do
describe '[east asian width]' do
it 'returns 2 for F' do
expect( '๏ผ'.display_width ).to eq 2
end
it 'returns 2 for W' do
expect( 'ไธ'.display_width ).to eq 2
en... | ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/lib/unicode/display_width.rb | lib/unicode/display_width.rb | # frozen_string_literal: true
require "unicode/emoji"
require_relative "display_width/constants"
require_relative "display_width/index"
require_relative "display_width/emoji_support"
module Unicode
class DisplayWidth
DEFAULT_AMBIGUOUS = 1
INITIAL_DEPTH = 0x10000
ASCII_NON_ZERO_REGEX = /[\0\x05\a\b\n-\x... | ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/lib/unicode/display_width/no_string_ext.rb | lib/unicode/display_width/no_string_ext.rb | # frozen_string_literal: true
warn "You are loading 'unicode-display_width/no_string_ext'\n" \
"Beginning with version 2.0, this is not necessary anymore\n"\
"You can just require 'unicode-display_width' now and no\n"\
"string extension will be loaded"
require_relative "../display_width"
| ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/lib/unicode/display_width/reline_ext.rb | lib/unicode/display_width/reline_ext.rb | # Experimental
# Patches Reline's get_mbchar_width to use Unicode::DisplayWidth
require "reline"
require "reline/unicode"
require_relative "../display_width"
class Reline::Unicode
def self.get_mbchar_width(mbchar)
Unicode::DisplayWidth.of(mbchar, Reline.ambiguous_width)
end
end
| ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/lib/unicode/display_width/index.rb | lib/unicode/display_width/index.rb | # frozen_string_literal: true
require "zlib"
require_relative "constants"
module Unicode
class DisplayWidth
File.open(INDEX_FILENAME, "rb") do |file|
serialized_data = Zlib::GzipReader.new(file).read
serialized_data.force_encoding Encoding::BINARY
INDEX = Marshal.load(serialized_data)
end
... | ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/lib/unicode/display_width/string_ext.rb | lib/unicode/display_width/string_ext.rb | # frozen_string_literal: true
require_relative "../display_width"
class String
def display_width(ambiguous = nil, overwrite = nil, old_options = {}, **options)
Unicode::DisplayWidth.of(self, ambiguous, overwrite, old_options = {}, **options)
end
end
| ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/lib/unicode/display_width/constants.rb | lib/unicode/display_width/constants.rb | # frozen_string_literal: true
module Unicode
class DisplayWidth
VERSION = "3.2.0"
UNICODE_VERSION = "17.0.0"
DATA_DIRECTORY = File.expand_path(File.dirname(__FILE__) + "/../../../data/")
INDEX_FILENAME = DATA_DIRECTORY + "/display_width.marshal.gz"
end
end
| ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
janlelis/unicode-display_width | https://github.com/janlelis/unicode-display_width/blob/14dd750e454563612622f09f84875b98b1d0cc5a/lib/unicode/display_width/emoji_support.rb | lib/unicode/display_width/emoji_support.rb | # frozen_string_literal: true
module Unicode
class DisplayWidth
module EmojiSupport
# Tries to find out which terminal emulator is used to
# set emoji: config to best suiting value
#
# Please also see section in README.md and
# misc/terminal-emoji-width.rb
#
# Please not... | ruby | MIT | 14dd750e454563612622f09f84875b98b1d0cc5a | 2026-01-04T17:51:48.429695Z | false |
logstash-plugins/logstash-filter-grok | https://github.com/logstash-plugins/logstash-filter-grok/blob/973a647eb915cb6cb41dc3dca07eeaa02b71dcaf/spec/spec_helper.rb | spec/spec_helper.rb | # encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "stud/temporary"
module LogStash::Environment
# running the grok code outside a logstash package means
# LOGSTASH_HOME will not be defined, so let's set it here
# before requiring the grok filter
unless self.const_defined?(:LOGSTASH_HOME)
... | ruby | Apache-2.0 | 973a647eb915cb6cb41dc3dca07eeaa02b71dcaf | 2026-01-04T17:51:55.085667Z | false |
logstash-plugins/logstash-filter-grok | https://github.com/logstash-plugins/logstash-filter-grok/blob/973a647eb915cb6cb41dc3dca07eeaa02b71dcaf/spec/filters/grok_performance_spec.rb | spec/filters/grok_performance_spec.rb | # encoding: utf-8
require_relative "../spec_helper"
begin
require "rspec-benchmark"
rescue LoadError # due testing against LS 5.x
end
RSpec.configure do |config|
config.include RSpec::Benchmark::Matchers if defined? RSpec::Benchmark::Matchers
end
require "logstash/filters/grok"
describe LogStash::Filters::Grok d... | ruby | Apache-2.0 | 973a647eb915cb6cb41dc3dca07eeaa02b71dcaf | 2026-01-04T17:51:55.085667Z | false |
logstash-plugins/logstash-filter-grok | https://github.com/logstash-plugins/logstash-filter-grok/blob/973a647eb915cb6cb41dc3dca07eeaa02b71dcaf/spec/filters/grok_spec.rb | spec/filters/grok_spec.rb | # encoding: utf-8
require_relative "../spec_helper"
require 'logstash/plugin_mixins/ecs_compatibility_support/spec_helper'
require "logstash/filters/grok"
describe LogStash::Filters::Grok do
subject { described_class.new(config) }
let(:config) { {} }
let(:event) { LogStash::Event.new(data) }
let(:data) { { "me... | ruby | Apache-2.0 | 973a647eb915cb6cb41dc3dca07eeaa02b71dcaf | 2026-01-04T17:51:55.085667Z | true |
logstash-plugins/logstash-filter-grok | https://github.com/logstash-plugins/logstash-filter-grok/blob/973a647eb915cb6cb41dc3dca07eeaa02b71dcaf/lib/logstash/filters/grok.rb | lib/logstash/filters/grok.rb | # encoding: utf-8
require "logstash/filters/base"
require "logstash/namespace"
require "logstash/environment"
require "logstash/patterns/core"
require 'logstash/plugin_mixins/ecs_compatibility_support'
require "grok-pure" # rubygem 'jls-grok'
require "timeout"
# Parse arbitrary text and structure it.... | ruby | Apache-2.0 | 973a647eb915cb6cb41dc3dca07eeaa02b71dcaf | 2026-01-04T17:51:55.085667Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/test/test_ssdp_search.rb | test/test_ssdp_search.rb | require 'test/unit'
require 'test/utilities'
require 'ssdp'
class TestSSDPSearch < SSDP::TestCase
def test_self_parse_search
search = SSDP::Search.parse util_search
assert_equal Time, search.date.class
assert_equal 'upnp:rootdevice', search.target
assert_equal 2, search.wait_time
end
def test_... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/test/test_ssdp.rb | test/test_ssdp.rb | require 'test/unit'
require_relative 'utilities'
require 'ssdp'
require 'upnp_savon/test_utilities'
class TestSSDP < SSDP::TestCase
def setup
super
@ssdp = SSDP.new
@ssdp.timeout = 0
end
def teardown
@ssdp.listener.kill if @ssdp.listener
end
def test_discover
socket = UPnPSavon::FakeSo... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/test/test_ssdp_response.rb | test/test_ssdp_response.rb | require 'test/unit'
require 'test/utilities'
require 'SSDP'
class TestSSDPResponse < SSDP::TestCase
def setup
super
@response = SSDP::Response.parse util_search_response
end
def test_self_parse_notify
assert_equal Time, @response.date.class
assert_equal true, @response.ext
assert_equal URI... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/test/test_ssdp_notification.rb | test/test_ssdp_notification.rb | require 'test/unit'
require 'test/utilities'
require 'ssdp'
class TestSSDPNotification < SSDP::TestCase
def test_self_parse_notify
notification = SSDP::Notification.parse util_notify
assert_equal Time, notification.date.class
assert_equal '239.255.255.250', notification.host
assert_equal '1900', no... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/features/support/common.rb | features/support/common.rb | Given /^I have a non-local IP address$/ do
@local_ip, @port = local_ip_and_port
@local_ip.should_not be_nil
@local_ip.should_not match /^127.0.0/
end
Given /^a UDP port on that IP is free$/ do
@port.should_not be_nil
end
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/features/support/fake_upnp_device_collection.rb | features/support/fake_upnp_device_collection.rb | require 'singleton'
require 'socket'
require 'ipaddr'
require_relative '../../lib/playful/ssdp/network_constants'
class FakeUPnPDeviceCollection
include Singleton
include Playful::SSDP::NetworkConstants
attr_accessor :respond_with
def initialize
@response = ''
@ssdp_listen_thread = nil
@serve_de... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/features/support/env.rb | features/support/env.rb | require 'socket'
require 'log_buddy'
require_relative '../../lib/playful/control_point'
def local_ip_and_port
orig, Socket.do_not_reverse_lookup = Socket.do_not_reverse_lookup, true
UDPSocket.open do |s|
s.connect '64.233.187.99', 1
s.addr.last
[s.addr.last, s.addr[1]]
end
ensure
Socket.do_not_rev... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/features/support/world_extensions.rb | features/support/world_extensions.rb | module HelperStuff
def control_point
@control_point ||= Playful::ControlPoint.new
end
def fake_device_collection
@fake_device_collection ||= FakeUPnPDeviceCollection.instance
end
def local_ip
@local_ip ||= local_ip_and_port.first
end
end
World(HelperStuff)
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/features/step_definitions/device_steps.rb | features/step_definitions/device_steps.rb | When /^I start my device on that IP address and port$/ do
@device = Playful::Device.new(@local_ip, @port)
@device.start.should be_true
end
Then /^the device multicasts a discovery message$/ do
pending # express the regexp above with the code you wish you had
end
Given /^I don't have an IP address$/ do
pending... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/features/step_definitions/control_point_steps.rb | features/step_definitions/control_point_steps.rb | When /^I create my control point$/ do
@control_point = Playful::ControlPoint.new
end
When /^tell it to find all root devices$/ do
@control_point.find_devices(:root, 5)
end
When /^tell it to find all services$/ do
@control_point.find_services
end
Then /^it gets a list of root devices$/ do
@control_point.devic... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/features/step_definitions/device_discovery_steps.rb | features/step_definitions/device_discovery_steps.rb | require_relative '../support/fake_upnp_device_collection'
require 'cucumber/rspec/doubles'
Thread.abort_on_exception = true
Playful::SSDP.log = false
Given /^there's at least (\d+) root device in my network$/ do |device_count|
fake_device_collection.respond_with = <<-ROOT_DEVICE
HTTP/1.1 200 OK\r
CACHE-CONTROL: max... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/spec_helper.rb | spec/spec_helper.rb | require 'simplecov'
SimpleCov.start
require 'coveralls'
Coveralls.wear!
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |file| require file }
ENV['RUBY_UPNP_ENV'] = 'testing'
RSpec.configure do |config|
#config.raise_errors_for_deprecati... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/support/search_responses.rb | spec/support/search_responses.rb | SSDP_SEARCH_RESPONSES_PARSED = {
root_device1: {
cache_control: 'max-age=1200',
date: 'Mon, 26 Sep 2011 06:40:19 GMT',
location: 'http://192.168.10.3:5001/description/fetch',
server: 'Linux-i386-2.6.38-10-generic-pae, UPnP/1.0, PMS/1.25.1',
st: 'upnp:rootdevice',
ext: nil,
usn: 'uuid:3c202... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/unit/core_ext/to_upnp_s_spec.rb | spec/unit/core_ext/to_upnp_s_spec.rb | require 'spec_helper'
require 'core_ext/to_upnp_s'
describe Hash do
describe '#to_upnp_s' do
context ':uuid as key' do
it "returns a String like 'uuid:[Hash value]'" do
expect({ uuid: '12345' }.to_upnp_s).to eq 'uuid:12345'
end
it "doesn't check if the Hash value is legit" do
... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/unit/playful/control_point_spec.rb | spec/unit/playful/control_point_spec.rb | require 'spec_helper'
require 'playful/control_point'
describe Playful::ControlPoint do
subject do
Playful::ControlPoint.new(1)
end
describe '#ssdp_search_and_listen' do
let(:notification) do
double 'notification'
end
let(:searcher) do
s = double 'Playful::SSDP::Searcher'
s.s... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/unit/playful/ssdp_spec.rb | spec/unit/playful/ssdp_spec.rb | require 'spec_helper'
require 'playful/ssdp'
describe Playful::SSDP do
subject { Playful::SSDP }
describe '.listen' do
let(:listener) do
searcher = double 'Playful::SSDP::Listener'
searcher.stub_chain(:alive_notifications, :pop).and_yield(%w[one two])
searcher.stub_chain(:byebye_notificatio... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/unit/playful/control_point/device_spec.rb | spec/unit/playful/control_point/device_spec.rb | require 'spec_helper'
require 'playful/control_point/device'
describe Playful::ControlPoint::Device do
pending
end
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/unit/playful/ssdp/searcher_spec.rb | spec/unit/playful/ssdp/searcher_spec.rb | require 'spec_helper'
require 'playful/ssdp/searcher'
describe Playful::SSDP::Searcher do
around(:each) do |example|
EM.synchrony do
example.run
EM.stop
end
end
before do
Playful.log = false
allow_any_instance_of(Playful::SSDP::MulticastConnection).to receive(:setup_multicast_socket... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/unit/playful/ssdp/listener_spec.rb | spec/unit/playful/ssdp/listener_spec.rb | require 'spec_helper'
require 'playful/ssdp/listener'
describe Playful::SSDP::Listener do
around(:each) do |example|
EM.synchrony do
example.run
EM.stop
end
end
before do
allow_any_instance_of(Playful::SSDP::Listener).to receive(:setup_multicast_socket)
end
subject { Playful::SSDP:... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/unit/playful/ssdp/notifier_spec.rb | spec/unit/playful/ssdp/notifier_spec.rb | require 'spec_helper'
require 'playful/ssdp/notifier'
describe Playful::SSDP::Notifier do
around(:each) do |example|
EM.synchrony do
example.run
EM.stop
end
end
let(:nt) { 'en tee' }
let(:usn) { 'you ess en' }
let(:ddf_url) { 'ddf url' }
let(:duration) { 567 }
subject do
Playfu... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/spec/unit/playful/ssdp/multicast_connection_spec.rb | spec/unit/playful/ssdp/multicast_connection_spec.rb | require 'spec_helper'
require 'playful/ssdp/multicast_connection'
describe Playful::SSDP::MulticastConnection do
around(:each) do |example|
EM.synchrony do
example.run
EM.stop
end
end
subject { Playful::SSDP::MulticastConnection.new(1) }
before do
Playful.log = false
end
describ... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful.rb | lib/playful.rb | require_relative 'playful/version'
module Playful
end
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/rack/upnp_control_point.rb | lib/rack/upnp_control_point.rb | require 'rack'
require_relative '../playful/control_point'
module Rack
# Middleware that allows your Rack app to keep tabs on devices that the
# {Playful::ControlPoint} has found. UPnP devices that match the +search_type+
# are discovered and added to the list, then removed as those devices send out
# +ssdp:... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/core_ext/hash_patch.rb | lib/core_ext/hash_patch.rb | class Hash
def symbolize_keys!
self.inject({}) { |result, (k, v)| result[k.to_sym] = v; result }
end
end
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/core_ext/to_upnp_s.rb | lib/core_ext/to_upnp_s.rb | class Hash
# Converts Hash search targets to SSDP search target String. Conversions are
# as follows:
# uuid: "someUUID" # => "uuid:someUUID"
# device_type: "someDeviceType:1" # => "urn:schemas-upnp-org:device:someDeviceType:1"
# service_type: "someServiceType:2" # => "urn:schemas-... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/core_ext/socket_patch.rb | lib/core_ext/socket_patch.rb | require 'socket'
# Workaround for missing constants on Windows
module Socket::Constants
IP_ADD_MEMBERSHIP = 12 unless defined? IP_ADD_MEMBERSHIP
IP_MULTICAST_LOOP = 11 unless defined? IP_MULTICAST_LOOP
IP_MULTICAST_TTL = 10 unless defined? IP_MULTICAST_TTL
IP_TTL = 4 unless defined? IP_TTL
end
cl... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/version.rb | lib/playful/version.rb | module Playful
VERSION = '0.1.0.alpha.1'
end
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/logger.rb | lib/playful/logger.rb | require 'log_switch'
module Playful
extend LogSwitch
end
Playful.log_class_name = true
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/ssdp.rb | lib/playful/ssdp.rb | require_relative '../core_ext/socket_patch'
require 'eventmachine'
require 'em-synchrony'
require_relative '../core_ext/to_upnp_s'
require_relative 'logger'
require_relative 'ssdp/error'
require_relative 'ssdp/network_constants'
require_relative 'ssdp/listener'
require_relative 'ssdp/searcher'
require_relative 'ssdp/no... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/device.rb | lib/playful/device.rb | require 'thin'
require 'em-synchrony'
require 'rack'
require 'rack/lobster'
module Playful
class Device
# Multicasts discovery messages to advertise its root device, any embedded
# devices, and any services.
def start
EM.synchrony do
web_server = Thin::Server.start('0.0.0.0', 3000) do
... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/control_point.rb | lib/playful/control_point.rb | require 'open-uri'
require 'nori'
require 'em-synchrony'
require_relative 'logger'
require_relative 'ssdp'
require_relative 'control_point/service'
require_relative 'control_point/device'
require_relative 'control_point/error'
module Playful
# Allows for controlling a UPnP device as defined in the UPnP spec for co... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/control_point/base.rb | lib/playful/control_point/base.rb | require 'nori'
require 'em-http-request'
require_relative 'error'
require_relative '../logger'
require_relative '../../playful'
module Playful
class ControlPoint
class Base
include LogSwitch::Mixin
protected
def get_description(location, description_getter)
log "Getting description w... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/control_point/service.rb | lib/playful/control_point/service.rb | require 'savon'
require_relative 'base'
require_relative 'error'
require_relative '../../core_ext/hash_patch'
require 'em-http'
HTTPI.adapter = :em_http
module Playful
class ControlPoint
# An object of this type functions as somewhat of a proxy to a UPnP device's
# service. The object sort of defines its... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/control_point/device.rb | lib/playful/control_point/device.rb | require_relative 'base'
require_relative 'service'
require_relative 'error'
require 'uri'
require 'eventmachine'
require 'time'
module Playful
class ControlPoint
class Device < Base
include EM::Deferrable
include LogSwitch::Mixin
attr_reader :ssdp_notification
#vvvvvvvvvvvvvvvvvvvvvvvv... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/control_point/error.rb | lib/playful/control_point/error.rb | module Playful
class ControlPoint
class Error < StandardError
#
end
# Indicates an error occurred when performing a UPnP action while controlling
# a device. See section 3.2 of the UPnP spec.
class ActionError < StandardError
#
end
end
end
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/ssdp/searcher.rb | lib/playful/ssdp/searcher.rb | require_relative '../logger'
require_relative 'multicast_connection'
module Playful
# A subclass of an EventMachine::Connection, this handles doing M-SEARCHes.
#
# Search types:
# ssdp:all
# upnp:rootdevice
# uuid:[device-uuid]
# urn:schemas-upnp-org:device:[deviceType-version]
# urn:schemas... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/ssdp/multicast_connection.rb | lib/playful/ssdp/multicast_connection.rb | require_relative '../../core_ext/socket_patch'
require_relative 'network_constants'
require_relative '../logger'
require_relative 'error'
require 'ipaddr'
require 'socket'
require 'eventmachine'
require 'em-synchrony'
module Playful
class SSDP
class MulticastConnection < EventMachine::Connection
include P... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/ssdp/notifier.rb | lib/playful/ssdp/notifier.rb | require_relative '../logger'
require_relative 'multicast_connection'
class Playful::SSDP::Notifier < Playful::SSDP::MulticastConnection
include LogSwitch::Mixin
def initialize(nt, usn, ddf_url, valid_for_duration)
@os = RbConfig::CONFIG['host_vendor'].capitalize + '/' +
RbConfig::CONFIG['host_os']
... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/ssdp/broadcast_searcher.rb | lib/playful/ssdp/broadcast_searcher.rb | require_relative '../../core_ext/socket_patch'
require_relative '../logger'
require_relative 'network_constants'
require 'ipaddr'
require 'socket'
require 'eventmachine'
# TODO: DRY this up!! (it's mostly the same as Playful::SSDP::MulticastConnection)
module Playful
class SSDP
class BroadcastSearcher < EventM... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/ssdp/network_constants.rb | lib/playful/ssdp/network_constants.rb | module Playful
class SSDP
module NetworkConstants
BROADCAST_IP = '255.255.255.255'
# Default multicast IP address
MULTICAST_IP = '239.255.255.250'
# Default multicast port
MULTICAST_PORT = 1900
# Default TTL
TTL = 4
end
end
end
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/ssdp/error.rb | lib/playful/ssdp/error.rb | module Playful
class SSDP
class Error < StandardError
end
end
end
| ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
turboladen/playful | https://github.com/turboladen/playful/blob/86f9dcab0ef98818f0317ebe6efe8e3e611ae050/lib/playful/ssdp/listener.rb | lib/playful/ssdp/listener.rb | require_relative 'multicast_connection'
class Playful::SSDP::Listener < Playful::SSDP::MulticastConnection
include LogSwitch::Mixin
# @return [EventMachine::Channel] Provides subscribers with notifications
# from devices that have come online (sent +ssdp:alive+ notifications).
attr_reader :alive_notificati... | ruby | MIT | 86f9dcab0ef98818f0317ebe6efe8e3e611ae050 | 2026-01-04T17:51:58.974526Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/simple_recommender_test.rb | test/simple_recommender_test.rb | require 'test_helper'
class SimpleRecommenderTest < ActiveSupport::TestCase
test "module exists" do
assert_kind_of Module, SimpleRecommender
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/test_helper.rb | test/test_helper.rb | # Configure Rails Environment
ENV["RAILS_ENV"] = "test"
require File.expand_path("../../test/dummy/config/environment.rb", __FILE__)
ActiveRecord::Migrator.migrations_paths = [File.expand_path("../../test/dummy/db/migrate", __FILE__)]
require "rails/test_help"
require "minitest/spec"
# Filter out Minitest backtrace ... | ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/app/helpers/application_helper.rb | test/dummy/app/helpers/application_helper.rb | module ApplicationHelper
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/app/controllers/application_controller.rb | test/dummy/app/controllers/application_controller.rb | class ApplicationController < ActionController::Base
# Prevent CSRF attacks by raising an exception.
# For APIs, you may want to use :null_session instead.
protect_from_forgery with: :exception
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/app/models/tag.rb | test/dummy/app/models/tag.rb | class Tag < ActiveRecord::Base
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/app/models/book.rb | test/dummy/app/models/book.rb | class Book < ActiveRecord::Base
include SimpleRecommender::Recommendable
has_and_belongs_to_many :tags
has_many :likes
has_many :users, through: :likes
belongs_to :author, class_name: "User"
similar_by :users
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/app/models/like.rb | test/dummy/app/models/like.rb | class Like < ActiveRecord::Base
belongs_to :user
belongs_to :book
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/app/models/user.rb | test/dummy/app/models/user.rb | class User < ActiveRecord::Base
has_and_belongs_to_many :books
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/schema.rb | test/dummy/db/schema.rb | # encoding: UTF-8
# This file is auto-generated from the current state of the database. Instead
# of editing this file, please use the migrations feature of Active Record to
# incrementally modify your database, and then regenerate this schema definition.
#
# Note that this schema.rb definition is the authoritative sou... | ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170123001909_create_books_users.rb | test/dummy/db/migrate/20170123001909_create_books_users.rb | class CreateBooksUsers < ActiveRecord::Migration
def change
create_table :books_users do |t|
t.references :book
t.references :user
end
add_index :books_users, [:book_id, :user_id], unique: true
add_index :books_users, :user_id
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170125034331_create_books_tags.rb | test/dummy/db/migrate/20170125034331_create_books_tags.rb | class CreateBooksTags < ActiveRecord::Migration
def change
create_table :books_tags do |t|
t.references :book, index: true, foreign_key: true
t.references :tag, index: true, foreign_key: true
end
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170125034341_remove_books_users.rb | test/dummy/db/migrate/20170125034341_remove_books_users.rb | class RemoveBooksUsers < ActiveRecord::Migration
def change
drop_table :books_users
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170125030446_create_likes.rb | test/dummy/db/migrate/20170125030446_create_likes.rb | class CreateLikes < ActiveRecord::Migration
def change
create_table :likes do |t|
t.references :user, index: true, foreign_key: true
t.references :book, index: true, foreign_key: true
t.timestamps null: false
end
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170125032813_add_author_to_books.rb | test/dummy/db/migrate/20170125032813_add_author_to_books.rb | class AddAuthorToBooks < ActiveRecord::Migration
def change
add_reference :books, :author, index: true
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170125030342_create_tags.rb | test/dummy/db/migrate/20170125030342_create_tags.rb | class CreateTags < ActiveRecord::Migration
def change
create_table :tags do |t|
t.string :name
t.timestamps null: false
end
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170123010745_enable_int_array_extension.rb | test/dummy/db/migrate/20170123010745_enable_int_array_extension.rb | class EnableIntArrayExtension < ActiveRecord::Migration
def change
enable_extension "intarray"
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170123001813_create_books.rb | test/dummy/db/migrate/20170123001813_create_books.rb | class CreateBooks < ActiveRecord::Migration
def change
create_table :books do |t|
t.string :name
t.timestamps null: false
end
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/db/migrate/20170123001819_create_users.rb | test/dummy/db/migrate/20170123001819_create_users.rb | class CreateUsers < ActiveRecord::Migration
def change
create_table :users do |t|
t.string :name
t.timestamps null: false
end
end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/test/models/tag_test.rb | test/dummy/test/models/tag_test.rb | require 'test_helper'
class TagTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/test/models/user_test.rb | test/dummy/test/models/user_test.rb | require 'test_helper'
class UserTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/test/models/like_test.rb | test/dummy/test/models/like_test.rb | require 'test_helper'
class LikeTest < ActiveSupport::TestCase
# test "the truth" do
# assert true
# end
end
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/test/models/book_test.rb | test/dummy/test/models/book_test.rb | require 'test_helper'
class BookTest < ActiveSupport::TestCase
describe BookTest do
let(:python_book) { Book.find_by(name: "Learning Python") }
let(:ruby_book) { Book.find_by(name: "Learning Ruby") }
let(:cpp_book) { Book.find_by(name: "Learning C++") }
let(:violin_book) { Book.find_by(name: "Playin... | ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/config/application.rb | test/dummy/config/application.rb | require File.expand_path('../boot', __FILE__)
# Pick the frameworks you want:
require "active_record/railtie"
require "action_controller/railtie"
require "action_mailer/railtie"
require "action_view/railtie"
# require "sprockets/railtie"
require "rails/test_unit/railtie"
Bundler.require(*Rails.groups)
require "simple... | ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/config/environment.rb | test/dummy/config/environment.rb | # Load the Rails application.
require File.expand_path('../application', __FILE__)
# Initialize the Rails application.
Rails.application.initialize!
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/config/routes.rb | test/dummy/config/routes.rb | Rails.application.routes.draw do
# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".
# You can have the root of your site routed with "root"
# root 'welcome#index'
# Example of regular route:
# get 'products/:id' => 'ca... | ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/config/boot.rb | test/dummy/config/boot.rb | # Set up gems listed in the Gemfile.
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
$LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
geoffreylitt/simple_recommender | https://github.com/geoffreylitt/simple_recommender/blob/4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b/test/dummy/config/initializers/filter_parameter_logging.rb | test/dummy/config/initializers/filter_parameter_logging.rb | # Be sure to restart your server when you modify this file.
# Configure sensitive parameters which will be filtered from the log file.
Rails.application.config.filter_parameters += [:password]
| ruby | MIT | 4f65be3fdadce3566d2e1bcc5ca8b71c9d2f921b | 2026-01-04T17:51:59.199045Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.