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 |
|---|---|---|---|---|---|---|---|---|
chrishunt/rubiks-cube | https://github.com/chrishunt/rubiks-cube/blob/3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0/lib/rubiks_cube/cube.rb | lib/rubiks_cube/cube.rb | module RubiksCube
# Standard 3x3x3 Rubik's Cube with normal turn operations (l, r, u, d, f, b)
class Cube
SOLVED_STATE = %w(
UF UR UB UL FL FR BR BL DF DR DB DL UFL URF UBR ULB DLF DFR DRB DBL
)
def initialize(state = nil)
@state = build_state_from_string(
state.to_s.empty? ? SOLVED... | ruby | MIT | 3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0 | 2026-01-04T17:51:24.361634Z | false |
chrishunt/rubiks-cube | https://github.com/chrishunt/rubiks-cube/blob/3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0/lib/rubiks_cube/solution.rb | lib/rubiks_cube/solution.rb | module RubiksCube
# Abstract interface for a RubiksCube solution
#
# Must implement:
# solution: array or string of moves necessary to solve the cube
# pretty: human readable string of solution
class Solution
attr_reader :cube
# Array or String of moves necessary to solve the cube
def sol... | ruby | MIT | 3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0 | 2026-01-04T17:51:24.361634Z | false |
chrishunt/rubiks-cube | https://github.com/chrishunt/rubiks-cube/blob/3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0/lib/rubiks_cube/bicycle_solution.rb | lib/rubiks_cube/bicycle_solution.rb | module RubiksCube
# Alias for TwoCycleSolution
BicycleSolution = TwoCycleSolution
end
| ruby | MIT | 3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0 | 2026-01-04T17:51:24.361634Z | false |
chrishunt/rubiks-cube | https://github.com/chrishunt/rubiks-cube/blob/3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0/lib/rubiks_cube/cubie.rb | lib/rubiks_cube/cubie.rb | # Generic cubie piece, either edge cubie or corner cubie
module RubiksCube
Cubie = Struct.new(:state) do
def ==(other)
state == other.state
end
def rotate!
self.state = state.split('').rotate.join
self
end
def rotate
Cubie.new(state.dup).rotate!
end
def to_s
... | ruby | MIT | 3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0 | 2026-01-04T17:51:24.361634Z | false |
chrishunt/rubiks-cube | https://github.com/chrishunt/rubiks-cube/blob/3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0/lib/rubiks_cube/algorithms.rb | lib/rubiks_cube/algorithms.rb | module RubiksCube
# Permutation and Orientation algorithms for two-cycle solution
module Algorithms
def self.reverse(algorithm)
algorithm.split.map do |move|
case modifier = move[-1]
when "'"
move[0]
when "2"
move
else
"#{move}'"
end
... | ruby | MIT | 3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0 | 2026-01-04T17:51:24.361634Z | false |
chrishunt/rubiks-cube | https://github.com/chrishunt/rubiks-cube/blob/3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0/lib/rubiks_cube/sticker_state_transform.rb | lib/rubiks_cube/sticker_state_transform.rb | module RubiksCube
# Transform manual sticker state entry to cube state
class StickerStateTransform
attr_reader :state
CENTER_LOCATIONS = [ 4, 13, 22, 31, 40, 49 ]
CORNER_LOCATIONS = [
42, 0 , 29, 44, 9, 2 , 38, 18, 11, 36, 27, 20,
45, 35, 6 , 47, 8, 15, 53, 17, 24, 51, 26, 33
]
ED... | ruby | MIT | 3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0 | 2026-01-04T17:51:24.361634Z | false |
chrishunt/rubiks-cube | https://github.com/chrishunt/rubiks-cube/blob/3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0/lib/rubiks_cube/two_cycle_solution.rb | lib/rubiks_cube/two_cycle_solution.rb | module RubiksCube
# Very inefficient two-cycle solving algorithm (aka bicycle solution)
# Useful for learning and blindfold
class TwoCycleSolution < Solution
def solution
@solution ||= begin
solution = []
solution << solution_for(:permutation)
solution << solution_for(:orientatio... | ruby | MIT | 3b276ac7dbc8c2afd02d351316d4eb6b1e0d14e0 | 2026-01-04T17:51:24.361634Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/spec/spec_helper.rb | spec/spec_helper.rb |
require "coveralls"
Coveralls.wear!
SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[
SimpleCov::Formatter::HTMLFormatter,
Coveralls::SimpleCov::Formatter
]
SimpleCov.start
require "bundler"
Bundler.setup :default, :development
require "minitest/spec"
require "minitest/autorun"
require "minitest/mock"
... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/spec/camper_van/command_definition_spec.rb | spec/camper_van/command_definition_spec.rb | require "spec_helper"
describe CamperVan::CommandDefinition do
before :each do
@test_commands = Class.new do
include CamperVan::CommandDefinition
attr_accessor :nick
handle :nick do |args|
@nick = args.first
args
end
end
end
it "defines a handle class method on ... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/spec/camper_van/server_reply_spec.rb | spec/camper_van/server_reply_spec.rb | require "spec_helper"
describe CamperVan::ServerReply do
before :each do
@test_server = Class.new do
include CamperVan::ServerReply
attr_reader :sent, :nick, :user, :host
def initialize
@sent = []
@nick, @user, @host = %w(nathan nathan localhost)
end
def send_line(d... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/spec/camper_van/ircd_spec.rb | spec/camper_van/ircd_spec.rb | require "spec_helper"
describe CamperVan::IRCD do
class TestConnection
attr_reader :sent
def initialize
@sent = []
end
def send_line(line)
@sent << line
end
def close_connection
end
def remote_ip
"127.0.0.1"
end
end
class TestIRCD < CamperVan::IRCD
a... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/spec/camper_van/command_parser_spec.rb | spec/camper_van/command_parser_spec.rb | require "spec_helper"
describe CamperVan::CommandParser do
class TestParser
include CamperVan::CommandParser
end
it "defines a parse method on a class that includes it" do
TestParser.new.must_respond_to :parse
end
describe "#parse" do
before :each do
@parser = TestParser.new
end
... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/spec/camper_van/server_spec.rb | spec/camper_van/server_spec.rb | require "spec_helper"
describe CamperVan::Server do
it "has a run module method" do
CamperVan::Server.must_respond_to :run
end
class TestServer
include CamperVan::Server
attr_reader :sent
attr_reader :tls_started
def initialize(*)
super
@sent = []
@tls_started = false
... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/spec/camper_van/user_spec.rb | spec/camper_van/user_spec.rb | require "spec_helper"
describe CamperVan::User do
context "when initialized from a firering user" do
# User = Struct.new(:connection, :id, :name, :email_address, :admin,
# :created_at, :type, :api_auth_token, :avatar_url)
let(:firering_user) {
Firering::User.new(
nil, 12345, "Joe Q. Bob", ... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/spec/camper_van/channel_spec.rb | spec/camper_van/channel_spec.rb | require "spec_helper"
describe CamperVan::Channel do
class TestClient
attr_reader :sent, :nick, :user, :host
attr_writer :nick
include CamperVan::ServerReply
def initialize
@nick, @user, @host = "nathan", "nathan", "localhost"
@sent = []
end
def send_line(line)
@sent << lin... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van.rb | lib/camper_van.rb | require "camper_van/version"
require "eventmachine"
require "firering"
require "logging"
module CamperVan
require "camper_van/debug_proxy" # debug proxy
require "camper_van/utils" # utility methods
require "camper_van/logger" # logging helper
require "camper_van/command_parser... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/server_reply.rb | lib/camper_van/server_reply.rb | module CamperVan
module ServerReply
# not an exhaustive list, just what i'm using
NUMERIC_REPLIES = {
# successful registration / welcome to the network
:rpl_welcome => "001",
:rpl_yourhost => "002",
:rpl_created => "003",
:rpl_myinfo ... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/version.rb | lib/camper_van/version.rb | module CamperVan
VERSION = "0.0.16"
end
| ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/channel.rb | lib/camper_van/channel.rb | # encoding: utf-8
require "yaml"
module CamperVan
class Channel
# The irc channel name this channel instance is for
attr_reader :channel
# The connected irc client connection
attr_reader :client
# The campfire room to which this channel is connected
attr_reader :room
# Accessor for t... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/logger.rb | lib/camper_van/logger.rb | module CamperVan
module Logger
# Public: the logger for this class
#
# Returns a Logging::Logger instance
def logger
CamperVan.logger
end
end
end
| ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/ircd.rb | lib/camper_van/ircd.rb | require "socket" # for gethostname
module CamperVan
# the IRCD is the server that IRC clients connect to. It handles:
#
# * irc client registration and validation against campfire
# * mapping irc commands to internal Commands
# * proxying irc commands to campfire channels
class IRCD
# The IRC client
... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/utils.rb | lib/camper_van/utils.rb | module CamperVan
module Utils
# TODO make irc-safe substitutions, etc.
def irc_name(name)
name.gsub('/', '-').
gsub(/\W/, ' ').
gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
gsub(/([a-z\d])([A-Z])/,'\1_\2').
gsub(/\s+/, "_").
tr("-", "_").
downcase
end
de... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/command_definition.rb | lib/camper_van/command_definition.rb | module CamperVan
class HandlerMissing < StandardError
attr_reader :command
def initialize(command)
@command = command
@message = "no handler for the #{command and command.keys.first} command"
end
end
module CommandDefinition
def self.included(base)
base.module_eval { include In... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/debug_proxy.rb | lib/camper_van/debug_proxy.rb | # debug proxy for dumping all irc traffic between a client and a server
module CamperVan
class DebugProxy < EM::Connection
include EM::Protocols::LineText2
def self.run(server, server_port=6667)
EM.run do
EM.start_server "localhost", 6667, DebugProxy, server, server_port
puts "* waiting... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/server.rb | lib/camper_van/server.rb | module CamperVan
# The core EventMachine server instance that listens for IRC
# connections and maps them to IRCD instances.
module Server
# Public: start the server
#
# bind_address - what address to bind to
# port - what port to listen on
# options - an optional hash of additio... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/command_parser.rb | lib/camper_van/command_parser.rb | module CamperVan
# simplistic IRC command parser
module CommandParser
# returns hash, e.g.
#
# malformed # => nil
# NICK joe # => # { :nick => ["joe"] }
# LIST # => # { :list => [] }
# PRIVMSG #foo :test # => { :privmsg => ['#foo', 'test'] }
#
def parse(line)
line = l... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
zerowidth/camper_van | https://github.com/zerowidth/camper_van/blob/984351a3b472e936a451f1d1cd987ca27d981d23/lib/camper_van/user.rb | lib/camper_van/user.rb | module CamperVan
class User
# IRC normalization from names
include Utils
# Public: the user's campfire id
attr_reader :id
# Public: the user's campfire name
attr_reader :name
# Public: the user's irc nick
attr_reader :nick
# Public: the user's unix account name for user@host p... | ruby | MIT | 984351a3b472e936a451f1d1cd987ca27d981d23 | 2026-01-04T17:51:28.743412Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/gems.rb | gems.rb | source "https://rubygems.org"
gemspec name: "fiber_scheduler"
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/spec_helper.rb | spec/spec_helper.rb | require_relative "../lib/fiber_scheduler"
RSpec.configure do |config|
config.expect_with :rspec do |expectations|
# will be the default in rspec 4
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
end
config.mock_with :rspec do |mocks|
# will be the default in rspec 4
mocks... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/fiber_scheduler/nested_fiber_scheduler_spec.rb | spec/fiber_scheduler/nested_fiber_scheduler_spec.rb | require "fiber_scheduler_spec/context"
RSpec.describe FiberScheduler do
describe "nested FiberScheduler" do
shared_examples :nested_fiber_scheduler do
include_context FiberSchedulerSpec::Context
let(:order) { [] }
context "with default arguments" do
context "with no non-blocking opera... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/fiber_scheduler/timeouts_spec.rb | spec/fiber_scheduler/timeouts_spec.rb | require "fiber_scheduler_spec/context"
RSpec.describe FiberScheduler::Timeouts do
describe "#call" do
include_context FiberSchedulerSpec::Context
let(:order) { [] }
let(:scheduler_class) { FiberScheduler }
let(:indices) { (-10..10).to_a }
context "with timeouts added randomly" do
def opera... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/fiber_scheduler/nested_fiber_schedule_spec.rb | spec/fiber_scheduler/nested_fiber_schedule_spec.rb | require "fiber_scheduler_spec/context"
RSpec.describe FiberScheduler do
describe "nested Fiber.schedule" do
shared_examples :nested_fiber_schedule do
include_context FiberSchedulerSpec::Context
let(:order) { [] }
context "with only sync operations" do
def operations
Fiber.sc... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/fiber_scheduler/fiber_scheduler_spec.rb | spec/fiber_scheduler/fiber_scheduler_spec.rb | require "fiber_scheduler_spec"
RSpec.describe FiberScheduler do
context "with default setup" do
include_examples FiberSchedulerSpec
end
context "with block setup" do
def setup
FiberScheduler do
operations
end
end
include_examples FiberSchedulerSpec
end
end
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/fiber_scheduler/blocking_fiber_spec.rb | spec/fiber_scheduler/blocking_fiber_spec.rb | require "fiber_scheduler_spec/context"
RSpec.describe FiberScheduler do
describe "blocking fiber" do
include_context FiberSchedulerSpec::Context
shared_examples :blocking_fiber_schedule do
let(:order) { [] }
context "when scheduled in a top-level fiber" do
def operations
Fiber... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/fiber_scheduler/volatile_fiber_spec.rb | spec/fiber_scheduler/volatile_fiber_spec.rb | require "fiber_scheduler_spec/context"
RSpec.describe FiberScheduler do
describe "volatile fiber" do
include_context FiberSchedulerSpec::Context
shared_examples :volatile_fiber_schedule do
let(:order) { [] }
context "when scheduled in a top-level fiber" do
def operations
Fiber... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/fiber_scheduler/async_compatibility_spec.rb | spec/fiber_scheduler/async_compatibility_spec.rb | require "async"
require "fiber_scheduler_spec/context"
RSpec.describe FiberScheduler do
describe "async compatibility" do
include_context FiberSchedulerSpec::Context
let(:order) { [] }
context "with Async block" do
context "without FiberScheduler options" do
it "behaves asynchronous" do
... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/spec/fiber_scheduler/waiting_fiber_spec.rb | spec/fiber_scheduler/waiting_fiber_spec.rb | require "fiber_scheduler_spec/context"
RSpec.describe FiberScheduler do
describe "waiting fiber" do
include_context FiberSchedulerSpec::Context
shared_examples :waiting_fiber_schedule do
let(:order) { [] }
context "when scheduled in a top-level fiber" do
def operations
Fiber.s... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/examples/performance.rb | examples/performance.rb | require "async"
require "benchmark"
require_relative "../lib/fiber_scheduler"
Benchmark.bmbm do |x|
# Max thread count is often 2048
iterations = 2_000
x.report("Async") do
Async do |task|
iterations.times do
task.async { sleep 0 }
end
end
end
x.report("Thread.new") do
itera... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/examples/volatile.rb | examples/volatile.rb | require_relative "../lib/fiber_scheduler"
FiberScheduler do
Fiber.schedule(:volatile) do
sleep 1000
end
Fiber.schedule do
sleep 2
end
end
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/examples/advanced.rb | examples/advanced.rb | require "httparty"
require "open-uri"
require "redis"
require "sequel"
require_relative "../lib/fiber_scheduler"
DB = Sequel.postgres
Sequel.extension(:fiber_concurrency)
FiberScheduler do
Fiber.schedule do
URI.open("https://httpbin.org/delay/2")
end
Fiber.schedule do
HTTParty.get("https://httpbin.org/... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/examples/nesting.rb | examples/nesting.rb | require_relative "../lib/fiber_scheduler"
FiberScheduler do
Fiber.schedule do
Fiber.schedule do
sleep 2
end
Fiber.schedule do
sleep 2
end
sleep 2
end
Fiber.schedule do
sleep 2
end
end
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/examples/blocking.rb | examples/blocking.rb | require_relative "../lib/fiber_scheduler"
FiberScheduler do
Fiber.schedule do
Fiber.schedule(:blocking) do
sleep 2
end
end
Fiber.schedule do
sleep 2
end
end
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/examples/basic.rb | examples/basic.rb | require "open-uri"
require_relative "../lib/fiber_scheduler"
FiberScheduler do
Fiber.schedule do
URI.open("https://httpbin.org/delay/2")
end
Fiber.schedule do
URI.open("https://httpbin.org/delay/2")
end
end
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/examples/waiting.rb | examples/waiting.rb | require_relative "../lib/fiber_scheduler"
FiberScheduler do
Fiber.schedule do
Fiber.schedule(:waiting) do
sleep 2
end
sleep 2
end
Fiber.schedule do
sleep 2
end
end
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/examples/scaling.rb | examples/scaling.rb | require_relative "../lib/fiber_scheduler"
FiberScheduler do
10_000.times do
Fiber.schedule do
sleep 2
end
end
end
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/lib/fiber_scheduler.rb | lib/fiber_scheduler.rb | require "resolv"
require_relative "fiber_scheduler/compatibility"
require_relative "fiber_scheduler/selector"
require_relative "fiber_scheduler/timeouts"
begin
# Use io/event selector if available
require "io/event"
rescue LoadError
end
module Kernel
def FiberScheduler(type = nil, &block)
if Fiber.scheduler... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/lib/fiber_scheduler/selector.rb | lib/fiber_scheduler/selector.rb | # Copyright, 2021, by Samuel G. D. Williams. <http://www.codeotaku.com>
#
# 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 | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/lib/fiber_scheduler/version.rb | lib/fiber_scheduler/version.rb | class FiberScheduler
VERSION = "0.13.0".freeze
end
| ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/lib/fiber_scheduler/timeout.rb | lib/fiber_scheduler/timeout.rb | class FiberScheduler
Error = Class.new(RuntimeError)
class Timeout
include Comparable
Error = Class.new(FiberScheduler::Error)
attr_reader :time
def initialize(duration, fiber, method, *args)
@time = Process.clock_gettime(Process::CLOCK_MONOTONIC) + duration
@fiber = fiber
@met... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/lib/fiber_scheduler/timeouts.rb | lib/fiber_scheduler/timeouts.rb | require_relative "timeout"
class FiberScheduler
class Timeouts
attr_reader :timeouts
def initialize
# Array is sorted by Timeout#time
@timeouts = []
end
def call
now = Process.clock_gettime(Process::CLOCK_MONOTONIC)
while @timeouts.any? && @timeouts.first.time <= now
... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
bruno-/fiber_scheduler | https://github.com/bruno-/fiber_scheduler/blob/442188f8c752aa236eb3254d52b3dc762d75ac81/lib/fiber_scheduler/compatibility.rb | lib/fiber_scheduler/compatibility.rb | class FiberScheduler
module Compatibility
Close = Class.new(RuntimeError)
def fiber(*args, **opts, &block)
return super unless Compatibility.internal?
# This is `Fiber.schedule` call inside `FiberScheduler { ... }` block.
type = args.first
case type
when :blocking
Fiber... | ruby | MIT | 442188f8c752aa236eb3254d52b3dc762d75ac81 | 2026-01-04T17:51:31.541762Z | false |
vinibaggio/discover-unused-partials | https://github.com/vinibaggio/discover-unused-partials/blob/ff574761f8b9bfc4e76868f7da3970efb7c05e59/spec/discover-unused-partials_spec.rb | spec/discover-unused-partials_spec.rb | # -*- coding: UTF-8 -*-
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
describe "DiscoverUnusedPartials" do
it "fails" do
fail "hey buddy, you should probably rename this file and start specing for real"
end
end
| ruby | MIT | ff574761f8b9bfc4e76868f7da3970efb7c05e59 | 2026-01-04T17:51:26.104063Z | false |
vinibaggio/discover-unused-partials | https://github.com/vinibaggio/discover-unused-partials/blob/ff574761f8b9bfc4e76868f7da3970efb7c05e59/spec/spec_helper.rb | spec/spec_helper.rb | # -*- coding: UTF-8 -*-
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'discover-unused-partials'
require 'rspec'
RSpec.configure do |config|
end
| ruby | MIT | ff574761f8b9bfc4e76868f7da3970efb7c05e59 | 2026-01-04T17:51:26.104063Z | false |
vinibaggio/discover-unused-partials | https://github.com/vinibaggio/discover-unused-partials/blob/ff574761f8b9bfc4e76868f7da3970efb7c05e59/lib/discover-unused-partials.rb | lib/discover-unused-partials.rb | # -*- coding: UTF-8 -*-
module DiscoverUnusedPartials
def self.find options={}
worker = PartialWorker.new options
tree, dynamic = Dir.chdir(options[:root]){ worker.used_partials("app") }
tree.each do |idx, level|
indent = " " * idx*2
h_indent = idx == 1 ? "" : "\n" + " "*(idx-1)*2
if ... | ruby | MIT | ff574761f8b9bfc4e76868f7da3970efb7c05e59 | 2026-01-04T17:51:26.104063Z | false |
vinibaggio/discover-unused-partials | https://github.com/vinibaggio/discover-unused-partials/blob/ff574761f8b9bfc4e76868f7da3970efb7c05e59/lib/discover-unused-partials/version.rb | lib/discover-unused-partials/version.rb | # frozen_string_literal: true
module DiscoverUnusedPartials
VERSION = "0.3.6"
end
| ruby | MIT | ff574761f8b9bfc4e76868f7da3970efb7c05e59 | 2026-01-04T17:51:26.104063Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor.rb | lib/rimportor.rb | require 'rimportor/active_record/sql_builder'
require 'rimportor/active_record/import'
require 'rimportor/plugin'
require 'rimportor/error/bulk_validation'
require 'rimportor/error/invalid_adapter'
require 'rimportor/active_record/adapter/mysql2'
require 'rimportor/util/connection'
require 'generators/install_generator... | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/generators/install_generator.rb | lib/generators/install_generator.rb | require 'rails/generators'
module Rimportor
class InstallGenerator < ::Rails::Generators::Base
source_root(File.expand_path(File.dirname(__FILE__)))
def copy_initializer
copy_file '../templates/rimportor.rb', 'config/initializers/rimportor.rb'
end
end
end | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor/version.rb | lib/rimportor/version.rb | module Rimportor
VERSION = "0.3"
end
| ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor/plugin.rb | lib/rimportor/plugin.rb | module Rimportor
module Plugin
extend ActiveSupport::Concern
included do
end
module ClassMethods
def rimport(records, options = {})
::Rimportor::ActiveRecord::Import.new(records, self.current_adapter, options).exec_statement
end
def current_adapter
load_adapter(::A... | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor/util/connection.rb | lib/rimportor/util/connection.rb | module Rimportor
module Util
class Connection
def self.in_pool
::ActiveRecord::Base.connection_pool.with_connection do |connection|
yield(connection)
end
end
end
end
end | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor/error/bulk_validation.rb | lib/rimportor/error/bulk_validation.rb | module Rimportor
module Error
class BulkValidation < StandardError
end
end
end | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor/error/invalid_adapter.rb | lib/rimportor/error/invalid_adapter.rb | module Rimportor
module Error
class InvalidAdapter < StandardError
end
end
end | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor/active_record/sql_builder.rb | lib/rimportor/active_record/sql_builder.rb | module Rimportor
module ActiveRecord
class SqlBuilder
def initialize(model)
@model = model
set_timestamps
end
def full_insert_statement
insert_manager.tap do |im|
im.insert(arel_for_create)
end.to_sql
end
def partial_insert_statement
... | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor/active_record/import.rb | lib/rimportor/active_record/import.rb | require 'parallel'
module Rimportor
module ActiveRecord
class Import
def initialize(bulk, adapter, opts = {})
@bulk = bulk
@adapter = adapter
@before_callbacks = !!opts[:before_callbacks]
@after_callbacks = !!opts[:after_callbacks]
@validate_bulk = !!opts[:validate_... | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/rimportor/active_record/adapter/mysql2.rb | lib/rimportor/active_record/adapter/mysql2.rb | module Rimportor
module ActiveRecord
module Adapter
class Mysql2
# Returns maximum number of bytes that the server will accept for a query
# @return [Fixnum] number of maximum allowed packet size
def max_allowed_packet
exec_in_pool do |connection|
result = conn... | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
erwinjunker/rimportor | https://github.com/erwinjunker/rimportor/blob/543bdd84a77e35365222901f4d00d6c02fd3acba/lib/templates/rimportor.rb | lib/templates/rimportor.rb | Rimportor.configure do |config|
# Configure how many threads rimportor should use for importing.
# Consider that rimportor will use threads not only for building the statement
# but also for running validations for your bulk.
# The default value are 4 threads
# config.threads = 4
end | ruby | MIT | 543bdd84a77e35365222901f4d00d6c02fd3acba | 2026-01-04T17:51:28.468036Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/spec_helper.rb | spec/spec_helper.rb | # frozen_string_literal: true
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..'))
require 'rubygems'
require 'rspec'
require 'timecop'
require 'notion_ruby_client'
Dir[File.join(File.dirname(__FILE__), 'support', '**/*.rb')].each do |file|
require file
end
Notion.configure do |config|
config.token = EN... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/support/vcr.rb | spec/support/vcr.rb | # frozen_string_literal: true
require 'vcr'
require 'webmock/rspec'
VCR.configure do |config|
config.cassette_library_dir = 'spec/fixtures/notion'
config.hook_into :webmock
# config.default_cassette_options = { record: :new_episodes }
config.configure_rspec_metadata!
config.before_record do |i|
if ENV.ke... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/support/token.rb | spec/support/token.rb | # frozen_string_literal: true
RSpec.configure do |config|
config.before do
@old_token = Notion::Config.token
end
config.after do
Notion::Config.reset
Notion::Config.token = @old_token
end
end | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/version_spec.rb | spec/notion/version_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Notion do
it 'has a version' do
expect(Notion::VERSION).not_to be nil
end
end | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/config_spec.rb | spec/notion/config_spec.rb | # frozen_string_literal: true
require 'spec_helper'
describe Notion::Config do
describe '#configure' do
before do
Notion.configure do |config|
config.token = 'a token'
end
end
it 'sets token' do
expect(Notion.config.token).to eq 'a token'
end
end
end | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/api/endpoints/blocks_spec.rb | spec/notion/api/endpoints/blocks_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Notion::Api::Endpoints::Blocks do
let(:client) { Notion::Client.new }
let(:block_id) { '32af3324-ba02-4516-ae88-5728a4d569f4' }
let(:children) do
[
{
'object': 'block',
'type': 'paragraph',
'paragraph': {
... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/api/endpoints/search_spec.rb | spec/notion/api/endpoints/search_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Notion::Api::Endpoints::Search do
let(:client) { Notion::Client.new }
context 'search' do
it 'searches', vcr: { cassette_name: 'search' } do
response = client.search
expect(response.results.size).to eq 2
end
it 'searches w... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/api/endpoints/pages_spec.rb | spec/notion/api/endpoints/pages_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Notion::Api::Endpoints::Pages do
let(:client) { Notion::Client.new }
let(:database_id) { 'dd428e9d-d3fe-4171-870d-a7a1902c748b' }
let(:page_id) { 'c7fd1abe-8114-44ea-be77-9632ea33e581' }
let(:property_id) { '%5BIFC' }
let(:properties) do
... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/api/endpoints/users_spec.rb | spec/notion/api/endpoints/users_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Notion::Api::Endpoints::Users do
let(:client) { Notion::Client.new }
context 'users' do
it 'me', vcr: { cassette_name: 'users_me' } do
response = client.me
expect(response.name).to eql 'Notion to Orbit'
end
it 'lists', vcr... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/api/endpoints/comments_spec.rb | spec/notion/api/endpoints/comments_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Notion::Api::Endpoints::Comments do
let(:client) { Notion::Client.new }
let(:discussion_comment) do
{
discussion_id: 'ea116af4839c410bb4ac242a18dc4392',
rich_text: [
{
text: {
content: 'test comment'
... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/api/endpoints/databases_spec.rb | spec/notion/api/endpoints/databases_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Notion::Api::Endpoints::Databases do
let(:client) { Notion::Client.new }
let(:database_id) { 'dd428e9dd3fe4171870da7a1902c748b' }
let(:page_id) { 'c7fd1abe811444eabe779632ea33e581' }
let(:title) do
[
{
"text": {
"con... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/spec/notion/pagination/cursor_spec.rb | spec/notion/pagination/cursor_spec.rb | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe Notion::Api::Pagination::Cursor do
let(:client) { Notion::Client.new }
context 'default cursor' do
let(:cursor) { described_class.new(client, 'users_list', {}) }
it 'provides a default page_size' do
expect(client).to receive(:users_... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion.rb | lib/notion.rb | # frozen_string_literal: true
require 'notion-ruby-client' | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion_ruby_client.rb | lib/notion_ruby_client.rb | # frozen_string_literal: true
require 'notion-ruby-client' | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion-ruby-client.rb | lib/notion-ruby-client.rb | # frozen_string_literal: true
require 'faraday'
require 'faraday/mashify'
require 'faraday/multipart'
require 'json'
require 'logger'
require 'hashie'
require_relative 'notion/version'
require_relative 'notion/logger'
require_relative 'notion/config'
# Messages
require_relative 'notion/messages/message'
require_rela... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/version.rb | lib/notion/version.rb | # frozen_string_literal: true
module Notion
VERSION = '1.2.2'
NOTION_REQUEST_VERSION = '2022-02-22'
end
| ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/logger.rb | lib/notion/logger.rb | # frozen_string_literal: true
require 'logger'
module Notion
class Logger < ::Logger
def self.default
return @default if @default
logger = new STDOUT
logger.level = Logger::WARN
@default = logger
end
end
end
| ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/client.rb | lib/notion/client.rb | # frozen_string_literal: true
module Notion
class Client
include Faraday::Connection
include Faraday::Request
include Api::Endpoints
attr_accessor(*Config::ATTRIBUTES)
def initialize(options = {})
Notion::Config::ATTRIBUTES.each do |key|
send("#{key}=", options.fetch(key, Notion.co... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/config.rb | lib/notion/config.rb | # frozen_string_literal: true
module Notion
module Config
extend self
ATTRIBUTES = %i[
proxy
user_agent
ca_path
ca_file
logger
endpoint
token
timeout
open_timeout
default_page_size
default_max_retries
default_retry_after
adapter
... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/messages/message.rb | lib/notion/messages/message.rb | # frozen_string_literal: true
module Notion
module Messages
class Message < Hashie::Mash
def to_s
keys.sort_by(&:to_s).map do |key|
"#{key}=#{self[key]}"
end.join(', ')
end
private
# see https://github.com/intridea/hashie/issues/394
def log_built_in_messag... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/errors.rb | lib/notion/api/errors.rb | # frozen_string_literal: true
module Notion
module Api
module Errors
class BadRequest < NotionError; end
class Forbidden < NotionError; end
class InternalError < NotionError; end
class InvalidRequest < NotionError; end
class ObjectNotFound < NotionError; end
class Unauthorized... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/endpoints.rb | lib/notion/api/endpoints.rb | # frozen_string_literal: true
require_relative 'endpoints/blocks'
require_relative 'endpoints/databases'
require_relative 'endpoints/pages'
require_relative 'endpoints/users'
require_relative 'endpoints/search'
require_relative 'endpoints/comments'
module Notion
module Api
module Endpoints
include Blocks
... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/error.rb | lib/notion/api/error.rb | # frozen_string_literal: true
module Notion
module Api
Error = Errors::NotionError
end
end | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/errors/notion_error.rb | lib/notion/api/errors/notion_error.rb | # frozen_string_literal: true
module Notion
module Api
module Errors
class NotionError < ::Faraday::Error
attr_reader :response
def initialize(message, details, response = nil)
super("#{message} #{details}")
@response = response
end
end
end
end
end | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/errors/too_many_requests.rb | lib/notion/api/errors/too_many_requests.rb | # frozen_string_literal: true
module Notion
module Api
module Errors
class TooManyRequests < ::Faraday::Error
attr_reader :response
def initialize(response)
@response = response
super 'Too many requests'
end
end
end
end
end
| ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/errors/internal_error.rb | lib/notion/api/errors/internal_error.rb | # frozen_string_literal: true
module Notion
module Api
module Errors
class ServerError < InternalError; end
class ParsingError < ServerError; end
class HttpRequestError < ServerError; end
class TimeoutError < HttpRequestError; end
class UnavailableError < HttpRequestError; end
en... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/endpoints/users.rb | lib/notion/api/endpoints/users.rb | # frozen_string_literal: true
module Notion
module Api
module Endpoints
module Users
#
# Retrieves the bot User associated with the API token provided in
# the authorization header. The bot will have an `owner` field with
# information about the person who authorized the int... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/endpoints/comments.rb | lib/notion/api/endpoints/comments.rb | # frozen_string_literal: true
module Notion
module Api
module Endpoints
module Comments
#
# Retrieves a list of un-resolved Comment objects from a page or block.
#
# @option options [id] :block_id
# Block or page id to fetch comments for.
#
# @option... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/endpoints/blocks.rb | lib/notion/api/endpoints/blocks.rb | # frozen_string_literal: true
module Notion
module Api
module Endpoints
module Blocks
#
# Retrieves a Block object using the ID specified.
#
# @option options [id] :block_id
# Block to get children info on.
def block(options = {})
throw ArgumentEr... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/endpoints/databases.rb | lib/notion/api/endpoints/databases.rb | # frozen_string_literal: true
module Notion
module Api
module Endpoints
module Databases
#
# Gets a paginated array of Page object s contained in the requested database,
# filtered and ordered according to the filter and sort objects provided in the request.
#
# Filt... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/endpoints/search.rb | lib/notion/api/endpoints/search.rb | # frozen_string_literal: true
module Notion
module Api
module Endpoints
module Search
#
# Searches all pages and child pages that are shared with the integration.
# The results may include databases.
#
# @option options [string] :query
# When supplied, limi... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/api/endpoints/pages.rb | lib/notion/api/endpoints/pages.rb | # frozen_string_literal: true
module Notion
module Api
module Endpoints
module Pages
#
# Retrieves a 📄Page object using the ID specified in the request path.
# Note that this version of the API only exposes page properties, not page content
#
# @option options [id]... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/pagination/cursor.rb | lib/notion/pagination/cursor.rb | # frozen_string_literal: true
module Notion
module Api
module Pagination
class Cursor
include Enumerable
attr_reader :client
attr_reader :verb
attr_reader :sleep_interval
attr_reader :max_retries
attr_reader :retry_after
attr_reader :params
d... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
phacks/notion-ruby-client | https://github.com/phacks/notion-ruby-client/blob/f651b70b665358f9001489c1a06325eb70ec3f64/lib/notion/faraday/connection.rb | lib/notion/faraday/connection.rb | # frozen_string_literal: true
module Notion
module Faraday
module Connection
private
def connection
@connection ||=
begin
options = {
headers: { 'Accept' => 'application/json; charset=utf-8' }
}
options[:headers]['User-Agent'] = use... | ruby | MIT | f651b70b665358f9001489c1a06325eb70ec3f64 | 2026-01-04T17:51:29.828973Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.