source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/unit/bunny_mock_spec.rb
Ruby
mit
45
master
528
describe BunnyMock do context '::new' do it 'should return a new session' do expect(BunnyMock.new.class).to eq(BunnyMock::Session) end end context '::version' do it 'should return the current version' do expect(BunnyMock::VERSION).to_not be_nil expect(BunnyMock.version).to_not be_nil end end con...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/unit/bunny_mock/queue_spec.rb
Ruby
mit
45
master
6,058
describe BunnyMock::Queue do before do @queue = @channel.queue 'testing.q' end context '#publish' do it 'should add message' do @queue.publish 'This is a test message' expect(@queue.message_count).to eq(1) expect(@queue.pop[2]).to eq('This is a test message') expect(@queue.mess...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/unit/bunny_mock/session_spec.rb
Ruby
mit
45
master
3,454
describe BunnyMock::Session do before do @session = BunnyMock::Session.new end context '::new' do it 'should start as not connected' do expect(@session.status).to eq(:not_connected) end end context '#start' do it 'should set status to connected' do expect(@session.start.status...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/unit/bunny_mock/channel_spec.rb
Ruby
mit
45
master
4,283
describe BunnyMock::Channel do context '::new' do before do @channel = BunnyMock::Channel.new @session, 1 end it 'should store connection' do expect(@channel.connection).to eq(@session) end it 'should store channel identifier' do expect(@channel.id).to eq(1) end it 'should set status to ope...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/unit/bunny_mock/exchange_spec.rb
Ruby
mit
45
master
4,380
describe BunnyMock::Exchange do context '::declare' do it 'should create a direct exchange' do expect(BunnyMock::Exchange.declare(@channel, 'testing.xchg', type: :direct).class).to eq(BunnyMock::Exchanges::Direct) end it 'should create a topic exchange' do expect(BunnyMock::Exchange.declare...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/unit/bunny_mock/exchanges/fanout_spec.rb
Ruby
mit
45
master
728
describe BunnyMock::Exchanges::Fanout do context '#deliver' do before do @source = @channel.fanout 'xchg.source' @first = @channel.queue 'queue.first' @second = @channel.queue 'queue.second' @third = @channel.queue 'queue.third' @first.bind @source @second.bind @source @third.bind @source ...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/unit/bunny_mock/exchanges/direct_spec.rb
Ruby
mit
45
master
635
describe BunnyMock::Exchanges::Direct do context '#deliver' do before do @source = @channel.direct 'xchg.source' @first = @channel.queue 'queue.first' @second = @channel.queue 'queue.second' @third = @channel.queue 'queue.third' @first.bind @source @second.bind @source @third.bind @source ...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/unit/bunny_mock/exchanges/topic_spec.rb
Ruby
mit
45
master
1,129
describe BunnyMock::Exchanges::Topic do context '#deliver' do before do @source = @channel.topic 'xchg.source' @first = @channel.queue 'queue.#' @second = @channel.queue 'queue.*.sub' @third = @channel.queue 'queue.*.sub.#' @first.bind @source @second.bind @source @thir...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/integration/queue_subscribe_spec.rb
Ruby
mit
45
master
1,054
describe BunnyMock::Queue, '#subscribe' do before do @ch1 = @session.channel @ch2 = @session.channel end context 'when delevered to an exchange' do it 'should be delevered in all queues bound to the routing key' do t = @ch1.topic 'amq.topic' q1 = @ch1.queue 'q1' q2 = @ch1.queue 'q2'...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/integration/queue_pop_spec.rb
Ruby
mit
45
master
2,026
describe BunnyMock::Queue, '#pop' do let(:queue) { @channel.queue('test.q') } let(:exchange) { @channel.topic('test.exchange') } let(:options) { { priority: 1, persistent: true, routing_key: 'test.q' } } before { queue.bind(exchange, routing_key: '*.q') } context 'when published through an exchange' do ...
github
arempe93/bunny-mock
https://github.com/arempe93/bunny-mock
spec/integration/message_acknowledgement_spec.rb
Ruby
mit
45
master
5,259
describe BunnyMock::Channel, 'acknowledgement' do let(:queue) { @channel.queue('test.q') } let(:delivery_tags) { {} } context 'when `manual_ack` = true' do before do queue.subscribe(manual_ack: true) do |delivery, _headers, body| delivery_tags[body] = delivery[:delivery_tag] end que...
github
samdunne/omniauth-gplus
https://github.com/samdunne/omniauth-gplus
omniauth-gplus.gemspec
Ruby
mit
45
master
1,408
# -*- encoding: utf-8 -*- $LOAD_PATH.push File.expand_path('../lib', __FILE__) require 'omniauth/gplus/version' Gem::Specification.new do |s| s.name = 'omniauth-gplus' s.version = OmniAuth::GPlus::VERSION s.authors = ['Sam Dunne', 'Kurtis Rainbolt-Greene'] s.email = %w(sam@sam-dunn...
github
samdunne/omniauth-gplus
https://github.com/samdunne/omniauth-gplus
Rakefile
Ruby
mit
45
master
818
#!/usr/bin/env ruby require 'bundler/gem_tasks' require 'rake/clean' require 'rake/testtask' require 'yard' begin Bundler.setup :default, :development rescue Bundler::BundlerError => error $stderr.puts error.message $stderr.puts 'Run `bundle install` to install missing gems.' exit error.status_code end Bundle...
github
samdunne/omniauth-gplus
https://github.com/samdunne/omniauth-gplus
lib/omniauth/strategies/gplus.rb
Ruby
mit
45
master
2,739
require 'omniauth/strategies/oauth2' module OmniAuth module Strategies class GPlus < OmniAuth::Strategies::OAuth2 class NoAuthorizationCodeError < StandardError; end class UnknownSignatureAlgorithmError < NotImplementedError; end option :client_options, :site => 'https://www.googl...
github
samdunne/omniauth-gplus
https://github.com/samdunne/omniauth-gplus
test/helper.rb
Ruby
mit
45
master
474
require 'coveralls' Coveralls.wear! require 'omniauth-gplus' require 'minitest/autorun' # require 'minitest/pride' OmniAuth.config.test_mode = true def application ->(_env) { [200, {}, ['Hello World.']] } end def strategy @strategy ||= begin OmniAuth::Strategies::GPlus.new(nil, *strategy_arguments).tap do |...
github
samdunne/omniauth-gplus
https://github.com/samdunne/omniauth-gplus
test/lib/omniauth/strategies/gplus_test.rb
Ruby
mit
45
master
2,174
require 'helper' require 'mocha/setup' # Test class for omniauth-gplus class TestOmniAuthGPlus < MiniTest::Unit::TestCase def setup @request = mock('Request') @request.stubs(:params).returns({}) @request.stubs(:cookies).returns({}) @request.stubs(:env).returns({}) @client_id = '123' @client_...
github
grosser/ie_iframe_cookies
https://github.com/grosser/ie_iframe_cookies
ie_iframe_cookies.gemspec
Ruby
mit
45
master
637
name = "ie_iframe_cookies" require "./lib/#{name}/version" Gem::Specification.new name, IEIframeCookies::VERSION do |s| s.summary = "Rails: Enabled cookies inside IFrames for IE via p3p headers" s.authors = ["Michael Grosser"] s.email = "michael@grosser.it" s.homepage = "https://github.com/grosser/#{name}" s...
github
grosser/ie_iframe_cookies
https://github.com/grosser/ie_iframe_cookies
Rakefile
Ruby
mit
45
master
262
require 'bundler/setup' require 'bundler/gem_tasks' require 'rake/testtask' require 'bump/tasks' require 'wwtd/tasks' Rake::TestTask.new(:test) do |test| test.pattern = 'test/ie_iframe_cookies_test.rb' test.verbose = true end task :default => "wwtd:local"
github
grosser/ie_iframe_cookies
https://github.com/grosser/ie_iframe_cookies
lib/ie_iframe_cookies.rb
Ruby
mit
45
master
1,557
require 'action_pack' module ActionController class Base before_filter :normal_cookies_for_ie_in_iframes def normal_cookies_for_ie_in_iframes! if request.ie_iframe_cookies_browser_is_ie? normal_cookies_for_ie_in_iframes(:force => true) cookies["using_iframes_in_ie"] = true end ...
github
grosser/ie_iframe_cookies
https://github.com/grosser/ie_iframe_cookies
test/test_helper.rb
Ruby
mit
45
master
650
require 'bundler/setup' require 'minitest/autorun' require 'minitest/rg' require 'active_support/all' require 'action_pack' require 'action_controller' ROUTES = ActionDispatch::Routing::RouteSet.new ROUTES.draw do match ':controller(/:action(/:id(.:format)))', :via => :any end ROUTES.finalize! # get routes working ...
github
grosser/ie_iframe_cookies
https://github.com/grosser/ie_iframe_cookies
test/ie_iframe_cookies_test.rb
Ruby
mit
45
master
4,273
require File.expand_path('../test_helper', __FILE__) class IETestController < ActionController::Base before_filter :normal_cookies_for_ie_in_iframes!, :only => :activate def activate render :text => 'OK' end def visit render :text => 'OK' end def with_etag options = {:etag => 'foo'} opti...
github
textmate/GitHub-Markdown.tmbundle
https://github.com/textmate/GitHub-Markdown.tmbundle
Support/bin/redcarpet.rb
Ruby
mit
45
master
1,786
#!/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby # Usage: markdown-github.rb [<file>...] # Convert one or more GitHub Flavored Markdown files to HTML and print to # standard output. With no <file> or when <file> is "-", read GitHub Flavored # Markdown source text from standard input. if ARGV.i...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
Rakefile
Ruby
mit
45
main
511
#!/usr/bin/env rake require "bundler/gem_tasks" require 'rake' require 'rspec/core/rake_task' desc "Open an irb session preloaded with this library" task :console do sh "bundle exec irb -rubygems -I lib -r tassadar.rb" end desc "Automatically run specs when files change." task :"spec:watchr" do sh "watchr spec/sp...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
Guardfile
Ruby
mit
45
main
211
# A sample Guardfile # More info at https://github.com/guard/guard#readme guard 'rspec' do watch(%r{^spec/.+_spec\.rb$}) watch(%r{^lib/(.+)\.rb$}) { "spec" } watch('spec/spec_helper.rb') { "spec" } end
github
agoragames/tassadar
https://github.com/agoragames/tassadar
tassadar.gemspec
Ruby
mit
45
main
1,095
# -*- encoding: utf-8 -*- $:.push File.expand_path("../lib", __FILE__) require "tassadar/version" Gem::Specification.new do |s| s.name = "tassadar" s.version = Tassadar::VERSION s.platform = Gem::Platform::RUBY s.authors = ["Matt Pruitt", "Andrew Nordman"] s.email = ["mpruitt@agoragam...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
spec/spec_helper.rb
Ruby
mit
45
main
237
$:.unshift File.join(File.dirname(__FILE__), '..', 'lib') require 'rubygems' require 'bundler/setup' require 'tassadar' REPLAY_DIR = File.join(File.dirname(__FILE__), 'replays') RSpec.configure do |config| config.mock_with :rr end
github
agoragames/tassadar
https://github.com/agoragames/tassadar
spec/tassadar/mpq_spec.rb
Ruby
mit
45
main
621
require 'spec_helper' describe Tassadar::MPQ::MPQ do let(:mpq) { Tassadar::MPQ::MPQ.read(File.read(File.join(REPLAY_DIR, 'patch150.SC2Replay'))) } it "reads the user data size" do expect(mpq.user_data_length).to eq(60) end it "has block_table entries" do expect(mpq.block_table.blocks.size).to eq(10) ...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
spec/tassadar/sc2/replay_spec.rb
Ruby
mit
45
main
733
require 'spec_helper' describe Tassadar::SC2::Game do let(:replay) { Tassadar::SC2::Replay.new(File.join(REPLAY_DIR, "patch150.SC2Replay")) } let(:replay_from_data) { Tassadar::SC2::Replay.new(nil, File.read(File.join(REPLAY_DIR, "patch150.SC2Replay"))) } it "has the same result" do expect(replay.game.winne...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
spec/tassadar/sc2/player_spec.rb
Ruby
mit
45
main
1,541
# encoding: UTF-8 require 'spec_helper' describe Tassadar::SC2::Player do subject(:player) { replay.players.last } context 'NA SC2 Replay' do let(:replay) { Tassadar::SC2::Replay.new(File.join(REPLAY_DIR, "OhanaLE.SC2Replay")) } it "sets the name" do expect(player.name).to eq("MLGLogan") end ...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
spec/tassadar/sc2/game_spec.rb
Ruby
mit
45
main
1,039
require 'spec_helper' describe Tassadar::SC2::Game do let(:replay) { Tassadar::SC2::Replay.new(File.join(REPLAY_DIR, "patch150.SC2Replay")) } it "sets the winner" do expect(replay.game.winner.name).to eq("Ratbaxter") end it "sets the map" do expect(replay.game.map).to eq("Scorched Haven") end it...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
spec/tassadar/mpq/block_table_spec.rb
Ruby
mit
45
main
1,265
require 'spec_helper' describe Tassadar::MPQ::ArchiveHeader do let(:mpq) { Tassadar::MPQ::MPQ.read(File.read(File.join(REPLAY_DIR, "Delta\ Quadrant.SC2Replay"))) } it "has 10 blocks" do expect(mpq.block_table.blocks.size).to eq(10) end it "has a valid block table entry" do block = mpq.block_table.blo...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
spec/tassadar/mpq/archive_header_spec.rb
Ruby
mit
45
main
2,303
require 'spec_helper' describe Tassadar::MPQ::ArchiveHeader do let(:archive_header) do Tassadar::MPQ::ArchiveHeader.read("MPQ\x1A,\x00\x00\x00P5\x00\x00\x01\x00\x03\x00\xB03\x00\x00\xB04\x00\x00\x10\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00") end describe "require a valid mag...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq.rb
Ruby
mit
45
main
2,169
require 'bindata' require 'tassadar/mpq/archive_size' require 'tassadar/mpq/archive_header' require 'tassadar/mpq/sector' require 'tassadar/mpq/file_data' require 'tassadar/mpq/block_table' require 'tassadar/mpq/hash_table' require 'tassadar/mpq/block_encryptor' module Tassadar module MPQ class MPQ < BinData::Re...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq/block_table.rb
Ruby
mit
45
main
974
module Tassadar module MPQ class BlockTable < BinData::Record endian :little array :blocks, :read_until => :eof do uint32 :block_offset uint32 :block_size uint32 :file_size uint32 :flags end end class EncryptedBlockTable < BinData::BasePrimitive ma...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq/hash_table.rb
Ruby
mit
45
main
1,284
module Tassadar module MPQ class FileTime < BinData::Record endian :little uint32 :low_date_time uint32 :high_date_time end class Md5 < BinData::Record endian :little string :md5_hash, :length => 16 end class HashTable < BinData::Record endian :little ...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq/crypt_buf.rb
Ruby
mit
45
main
244
module Tassadar module MPQ module CryptBuf def self.[](index) crypt_buf[index] end def self.crypt_buf @@crypt_buff ||= crypt_buf! end def self.crypt_buf! end end end end
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq/block_encryptor.rb
Ruby
mit
45
main
2,493
module Tassadar module MPQ class BlockEncryptor attr_accessor :key, :offset, :buffer, :size def initialize(key, offset, buffer, size) @key = key @offset = offset @buffer = buffer @size = size end def self.hash_string(key, offset) BlockEncryptor.new...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq/archive_size.rb
Ruby
mit
45
main
536
module Tassadar module MPQ class ArchiveSize < BinData::Primitive endian :little def get [eval_parameter(:hash_table_offset) + (eval_parameter(:hash_table_entries) * 16), eval_parameter(:block_table_offset) + (eval_parameter(:block_table_entries) * 16)].max end def set(v...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq/file_data.rb
Ruby
mit
45
main
2,076
require 'zlib' require 'rbzip2' require 'stringio' module Tassadar module MPQ class FileData < BinData::Record MPQ_FILE_ENCRYPTED = 0x00010000 MPQ_FILE_EXISTS = 0x80000000 MPQ_SINGLE_UNIT = 0x01000000 MPQ_COMPRESSED = 0x00000200 attr_accessor :block_offset endian :little ...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq/sector.rb
Ruby
mit
45
main
557
module Tassadar module MPQ class Sector < BinData::Record endian :little uint8 :compression_mask end class SectorArray < BinData::BasePrimitive mandatory_parameters :sector_offsets, :sector_size def read_and_return_value(io) result = [] file_data_offset = parent....
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/mpq/archive_header.rb
Ruby
mit
45
main
547
module Tassadar module MPQ class ArchiveHeader < BinData::Record endian :little string :magic, :length => 4 uint32 :header_size uint32 :archive_size uint16 :format_version uint8 :sector_size_shift skip :length => 1 uint32 :hash_table_offset uint32 :...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/sc2/game.rb
Ruby
mit
45
main
1,176
module Tassadar module SC2 class Game attr_accessor :map, :time, :winner, :speed, :type, :category attr_reader :replay def initialize(replay) @replay = replay @winner = replay.players.select {|p| p.won}.first @time = convert_windows_to_ruby_date_time(replay.details.dat...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/sc2/replay.rb
Ruby
mit
45
main
715
require 'tassadar/sc2/reverse_string' require 'tassadar/sc2/serialized_data' require 'tassadar/sc2/attributes' require 'tassadar/sc2/details' require 'tassadar/sc2/player' require 'tassadar/sc2/game' module Tassadar module SC2 class Replay attr_accessor :mpq, :attributes, :details, :players, :game d...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/sc2/serialized_data.rb
Ruby
mit
45
main
2,136
module Tassadar module SC2 class SerializedData < BinData::BasePrimitive def read_and_return_value(io) key = io.readbytes(1).unpack("C").first case key when 0 read_array(io) when 2 read_byte_string(io) when 3 flag = io.readbytes(1) ...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/sc2/player.rb
Ruby
mit
45
main
918
module Tassadar module SC2 class Player attr_accessor :id, :won, :color, :chosen_race, :actual_race, :handicap, :team attr_writer :name def initialize(details_hash, attributes) @name = details_hash[0] @id = details_hash[1][4] @won = [false, true, false][details_hash[8]] ...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/sc2/attributes.rb
Ruby
mit
45
main
562
# https://github.com/GraylinKim/sc2reader/wiki/replay.attributes.events module Tassadar module SC2 class Attribute < BinData::Record endian :little string :header, :read_length => 4, :check_value => "\xE7\x03\x00\x00" uint32 :id uint8 :player_number reverse_string :attribute_value,...
github
agoragames/tassadar
https://github.com/agoragames/tassadar
lib/tassadar/sc2/reverse_string.rb
Ruby
mit
45
main
303
module Tassadar module SC2 class ReverseString < BinData::String mandatory_parameters :read_length def read_and_return_value(io) super.reverse.gsub("\x00", '') end def value_to_binary_string(value) clamp_to_length(val.reverse) end end end end
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
puredata.gemspec
Ruby
mit
45
master
730
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'puredata/version' Gem::Specification.new do |spec| spec.name = "puredata" spec.version = Puredata::VERSION spec.authors = ["CHIKANAGA Tomoyuki"] spec.email = ...
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
lib/puredata/canvas.rb
Ruby
mit
45
master
2,145
# vim:encoding=utf-8 # # Ruby/PureData Canvas, Abstraction class class PureData class Canvas def initialize(pd, name, opt={}) @pd = pd @name = name.dup unless /\.pd\Z/ =~ @name @name += ".pd" end @dir = File.expand_path(opt[:dir] || Dir.pwd) @pdobjid = 0 pos = op...
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
lib/puredata/connection.rb
Ruby
mit
45
master
1,028
# vim:encoding=utf-8 # # PureData connection (inlet/outlet) control class PureData class IOlet def initialize(obj, idx=0) @obj = obj @idx = idx end attr_reader :idx def canvas @obj.canvas end def pdobjid @obj.pdobjid end def name @obj.name end ...
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
lib/puredata/pdobject.rb
Ruby
mit
45
master
204
# vim:encoding=utf-8 # # Ruby/PureData Pd object wrapper classes require "puredata/pdobject/pdobject" require "puredata/pdobject/osc" require "puredata/pdobject/dac" require "puredata/pdobject/receive"
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
lib/puredata/pd.rb
Ruby
mit
45
master
2,392
# vim:encoding=utf-8 # # Ruby/PureData early scrach version. require "socket" require "puredata/canvas" class PureData case RUBY_PLATFORM when /darwin/ @@pd_app_path = "/Applications/Pd-extended.app/Contents/Resources/bin/pd" else @@pd_app_path = nil end def self.start(opt={}, &blk) pd = self....
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
lib/puredata/pdobject/pdobject.rb
Ruby
mit
45
master
865
# vim:encoding=utf-8 # # Ruby/PureData ojbect wrapper base class class PureData @@pdclass = {} def self.register_pdobject(klass, *names) names.each do |n| @@pdclass[n] = klass end end def self.dispatch_object_class(klass, *args) cls = @@pdclass[klass.to_s] cls ||= PdObject cls en...
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
lib/puredata/pdobject/dac.rb
Ruby
mit
45
master
216
# vim:encoding=utf-8 # # dac~ object class class PureData class Dac < PdObject def left inlet(0) end def right inlet(1) end end end PureData.register_pdobject(PureData::Dac, "dac~")
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
lib/puredata/pdobject/receive.rb
Ruby
mit
45
master
220
# vim:encoding=utf-8 # # receive object class class PureData class Receive < PdObject def msg(*args) @pd.msg(@args[0], *args) end end end PureData.register_pdobject(PureData::Receive, "receive", "r")
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
example/example.rb
Ruby
mit
45
master
875
require "puredata" PureData.start(:port => 10002) do |pd| # create canvas "sample.pd" canvas = pd.canvas("sample") # osc~ => *~ 0.1 => dac~ osc = canvas.obj("osc~", 440) mul = canvas.obj("*~", 0.3) dac = canvas.obj("dac~") canvas.connect(osc.outlet, mul.inlet(0)) canvas.connect(mul.outlet, dac.left) ...
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
example/abstraction.rb
Ruby
mit
45
master
449
require "puredata" Pd.start do |pd| # create abstraction "osc440.pd" sample = pd.abstraction("osc440") do |abst| abst.add_outlet(true) osc = abst.obj("osc~", 440) mul = abst.obj("*~", 0.3) osc >> mul abst.outlet(0) << mul end canvas = pd.canvas("sample") osc440 = canvas.obj("osc440") d...
github
nagachika/ruby-puredata
https://github.com/nagachika/ruby-puredata
example/save.rb
Ruby
mit
45
master
489
require "puredata" Pd.start do |pd| # create canvas "sample.pd" canvas = pd.canvas("sample") # osc~ => *~ 0.1 => dac~ osc = canvas.obj("osc~", 440) mul = canvas.obj("*~", 0.3) dac = canvas.obj("dac~") canvas.connect(osc.outlet, mul.inlet(0)) canvas.connect(mul.outlet, dac.left) canvas.connect(mul.ou...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
troupe.gemspec
Ruby
mit
45
master
962
# coding: utf-8 lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'troupe/version' Gem::Specification.new do |spec| spec.name = "troupe" spec.version = Troupe::VERSION spec.authors = ["Jon Stokes"] spec.email = ["jon@jonstoke...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
spec/integration_spec.rb
Ruby
mit
45
master
43,461
require 'spec_helper' describe "Integration" do def build_interactor(&block) interactor = Class.new.send(:include, Troupe) interactor.class_eval do permits(:steps) { [] } end interactor.class_eval(&block) if block interactor end def build_organizer(options = {}, &block) organizer =...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
spec/troupe/contract_spec.rb
Ruby
mit
45
master
7,798
require 'spec_helper' module Troupe describe Contract do def build_contracted(&block) contracted = Class.new.send(:include, Troupe) contracted.class_eval(&block) if block contracted end describe "::property" do it "raises an error for an invalid value for the 'presence' option" ...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
spec/troupe/contract/property_table_spec.rb
Ruby
mit
45
master
1,987
require 'spec_helper' module Troupe module Contract describe PropertyTable do let(:table) { Troupe::Contract::PropertyTable.new } describe "#set" do it "initializes a new property" do table.set(:property1, presence: :expected, default: :method_name) property = table.get(...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
lib/troupe.rb
Ruby
mit
45
master
679
require "interactor" require "troupe/version" require "troupe/contract_violation" require "troupe/contract" require "troupe/contract/property" require "troupe/contract/property_table" module Troupe def self.included(base) Interactor::Context.class_eval do def members @table.keys end end ...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
lib/troupe/contract_violation.rb
Ruby
mit
45
master
361
module Troupe class ContractViolation < StandardError attr_reader :context, :property def initialize(context=nil, opts={}) @context = context @property = opts[:property] @message = opts[:message] super() end def message @message || "Property '#{property}' violated the i...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
lib/troupe/contract.rb
Ruby
mit
45
master
3,929
module Troupe module Contract VALID_TYPES = %i(open closed) def self.included(base) base.class_eval do extend ClassMethods include InstanceMethods end end module InstanceMethods private def violation_table @violation_table ||= {} end def...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
lib/troupe/contract/property_table.rb
Ruby
mit
45
master
1,601
module Troupe module Contract class PropertyTable def initialize @table ||= {} end def get(property_name) @table[property_name] end def set(property_name, opts={}) @table[property_name] ||= Property.new(opts) @table[property_name].merge!(opts) ...
github
jonstokes/troupe
https://github.com/jonstokes/troupe
lib/troupe/contract/property.rb
Ruby
mit
45
master
811
module Troupe module Contract class Property DEFAULTS = { presence: :provided } VALID_OPTIONS = { presence: [:expected, :permitted, :provided] } attr_accessor :default, :on_violation, :presence def initialize(opts={}) validate_options(opts) opts = DEFAULTS....
github
castwide/readapt
https://github.com/castwide/readapt
Rakefile
Ruby
mit
45
master
283
require "bundler/gem_tasks" require "rspec/core/rake_task" require "rake/extensiontask" require 'readapt/version' require 'tmpdir' RSpec::Core::RakeTask.new(:spec) task :default => :spec # Compile tasks Rake::ExtensionTask.new "readapt" do |ext| ext.lib_dir = "lib/readapt" end
github
castwide/readapt
https://github.com/castwide/readapt
readapt.gemspec
Ruby
mit
45
master
1,746
lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "readapt/version" Gem::Specification.new do |spec| spec.name = "readapt" spec.version = Readapt::VERSION spec.authors = ["Fred Snyder"] spec.email = ["fsnyder@castwide.com"] sp...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt.rb
Ruby
mit
45
master
515
require 'backport' require 'readapt/version' require 'readapt/readapt' require 'readapt/references' require 'readapt/breakpoint' require 'readapt/thread' require 'readapt/frame' require 'readapt/monitor' require 'readapt/snapshot' require 'readapt/finder' require 'readapt/debugger' require 'readapt/message' require 'r...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/error.rb
Ruby
mit
45
master
1,320
require 'securerandom' module Readapt module Error class << self attr_accessor :adapter end def opening @buffer = '' end def receiving data output = '' data.each_char do |char| @buffer += char if open_message.start_with?(@buffer) || @buffer.start_with?(op...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/debugger.rb
Ruby
mit
45
master
5,651
# frozen_string_literal: true require 'backport' require 'observer' require 'set' module Readapt class Debugger include Observable include Finder attr_reader :monitor attr_reader :file attr_writer :pause_on_raise def initialize @stack = [] @frames = {} @running = false ...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/adapter.rb
Ruby
mit
45
master
2,313
# frozen_string_literal: true require 'json' module Readapt module Adapter # @!parse include Backport::Adapter @@debugger = nil def self.host debugger @@debugger = debugger end def self.procid= pid @@procid = pid end def procid @@procid end def open_message...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/finder.rb
Ruby
mit
45
master
1,013
require 'pathname' module Readapt # Methods to find a program in the current directory or one of the # environment paths. # module Finder module_function # Get the program's fully qualified path. Search first in the current # directory, then the environment paths. # # @raise [LoadError] if...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/thread.rb
Ruby
mit
45
master
309
# frozen_string_literal: true require 'ostruct' module Readapt class Thread # @return [Symbol] attr_accessor :control # @return [String] def name @name ||= "Thread #{id}" end # # @return [Object] def object ObjectSpace._id2ref(thread_object_id) end end end
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/references.rb
Ruby
mit
45
master
612
module Readapt module References module_function @variable_reference_map = {} @reference_variable_map = {} @reference_id = 1000 def clear @variable_reference_map.clear @reference_variable_map.clear @reference_id = 1000 end def identify object return @variable_ref...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/shell.rb
Ruby
mit
45
master
3,028
require 'thor' require 'backport' require 'open3' require 'securerandom' require 'socket' module Readapt class Shell < Thor map %w[--version -v] => :version desc "--version, -v", "Print the version" def version puts Readapt::VERSION end desc 'socket', 'Run a DAP server over TCP' optio...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/snapshot.rb
Ruby
mit
45
master
877
# frozen_string_literal: true module Readapt # Information about the state of the debugger. # class Snapshot # @return [Integer] attr_reader :thread_id # @return [String] attr_reader :file # @return [Integer] attr_reader :line # The reason for pausing the debugging, e.g., "breakpoi...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/monitor.rb
Ruby
mit
45
master
415
module Readapt # The module responsible for stepping through code and providing snapshots. # # @!method self.start &block # Enable tracepoints. Yield a Snapshot to the provided block for every # stop (breakpoints, steps, etc.). # @yieldparam [Snapshot] # @return [Boolean] # # @!method self.sto...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/server.rb
Ruby
mit
45
master
367
require 'securerandom' require 'stringio' module Readapt module Server class << self attr_accessor :target_in attr_accessor :target_pid end def opening Error.adapter = self Output.adapter = self end def receiving data Server.target_in.syswrite data rescue Errno...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/variable.rb
Ruby
mit
45
master
1,538
# frozen_string_literal: true module Readapt # Data retrieved from variable reference in the debugger. # class Variable # @return [String] attr_reader :name # @param name [String, Symbol] # @param object [Object] def initialize name, object @name = name @object = object end ...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/frame.rb
Ruby
mit
45
master
915
# frozen_string_literal: true module Readapt # @!method file # @return [String] # @!method line # @return [Integer] # @!method binding_id # @return [Integer] # @!method initialize(file, line, binding_id) class Frame def evaluate code frame_binding.eval(code).inspect rescue StandardE...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/data_reader.rb
Ruby
mit
45
master
1,724
module Readapt class DataReader def initialize @in_header = true @content_length = 0 @buffer = String.new end # Declare a block to be executed for each message received from the # client. # # @yieldparam [Hash] The message received from the client def set_message_handler...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/output.rb
Ruby
mit
45
master
514
module Readapt module Output class << self attr_accessor :adapter end def receiving data send_event('output', { output: data.force_encoding('utf-8'), category: 'stdout' }) end def send_event event, data obj = { type: 'event', event: event ...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message.rb
Ruby
mit
45
master
2,036
# frozen_string_literal: true require 'readapt/message/base' require 'readapt/message/initialize' require 'readapt/message/launch' require 'readapt/message/set_breakpoints' require 'readapt/message/set_exception_breakpoints' require 'readapt/message/configuration_done' require 'readapt/message/threads' require 'readap...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/breakpoint.rb
Ruby
mit
45
master
427
module Readapt class Breakpoint attr_reader :source attr_reader :line attr_reader :condition attr_reader :hit_condition attr_writer :hit_cursor def initialize source, line, condition, hit_condition @source = source @line = line @condition = condition @hit_condition = h...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/threads.rb
Ruby
mit
45
master
306
# frozen_string_literal: true module Readapt module Message class Threads < Base def run set_body({ threads: debugger.threads.map do |thr| { id: thr.id, name: thr.name } end }) end end end end
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/initialize.rb
Ruby
mit
45
master
537
# frozen_string_literal: true module Readapt module Message class Initialize < Base def run set_body({ supportsConfigurationDoneRequest: true, exceptionBreakpointFilters: [ { filter: 'raise', label: 'Break on raised exceptions', ...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/scopes.rb
Ruby
mit
45
master
584
# frozen_string_literal: true module Readapt module Message class Scopes < Base def run frame = debugger.frame(arguments['frameId']) set_body({ scopes: [ { name: 'Local', variablesReference: frame.local_id, expensive: false ...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/evaluate.rb
Ruby
mit
45
master
385
# frozen_string_literal: true require 'json' module Readapt module Message class Evaluate < Base def run ref = arguments['frameId'] frame = debugger.frame(ref) expression = arguments['expression'] result = ref ? frame.evaluate(expression) : eval(expression) set_body...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/set_breakpoints.rb
Ruby
mit
45
master
679
# frozen_string_literal: true module Readapt module Message class SetBreakpoints < Base def run path = Readapt.normalize_path(arguments['source']['path']) debugger.clear_breakpoints path lines = [] set_body( breakpoints: arguments['breakpoints'].map do |val| ...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/next.rb
Ruby
mit
45
master
214
# frozen_string_literal: true module Readapt module Message class Next < Base def run thread = debugger.thread(arguments['threadId']) thread.control = :next end end end end
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/base.rb
Ruby
mit
45
master
526
# frozen_string_literal: true module Readapt module Message class Base # @return [Hash] attr_reader :arguments # @return [Debugger] attr_reader :debugger def initialize arguments, debugger @arguments = arguments @debugger = debugger end def run; end ...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/set_exception_breakpoints.rb
Ruby
mit
45
master
243
# frozen_string_literal: true module Readapt module Message class SetExceptionBreakpoints < Base def run debugger.pause_on_raise = arguments['filters'] && arguments['filters'].include?('raise') end end end end
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/disconnect.rb
Ruby
mit
45
master
310
# frozen_string_literal: true module Readapt module Message class Disconnect < Base def run # The message only sets an empty body to acknowledge that the request # was received. The adapter handles the actual disconnection process. set_body({}) end end end end
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/continue.rb
Ruby
mit
45
master
289
# frozen_string_literal: true module Readapt module Message class Continue < Base def run thread = debugger.thread(arguments['threadId']) thread.control = :continue set_body({ allThreadsContinued: false }) end end end end
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/variables.rb
Ruby
mit
45
master
1,553
# frozen_string_literal: true module Readapt module Message class Variables < Base def run ref = arguments['variablesReference'] frame = debugger.frame(ref) # @todo 1 is a magic number representing the toplevel binding (see # Message::Scopes) vars = if ref == 1 ...
github
castwide/readapt
https://github.com/castwide/readapt
lib/readapt/message/stack_trace.rb
Ruby
mit
45
master
833
# frozen_string_literal: true module Readapt module Message class StackTrace < Base @@file_hash = {} def run frames = debugger.thread(arguments['threadId']).frames set_body({ stackFrames: frames.map do |frm| { name: frame_code(frm.file, frm.line), ...
github
castwide/readapt
https://github.com/castwide/readapt
spec/spec_helper.rb
Ruby
mit
45
master
399
require "bundler/setup" require 'simplecov' SimpleCov.start require "readapt" RSpec.configure do |config| # Enable flags like --only-failures and --next-failure config.example_status_persistence_file_path = ".rspec_status" # Disable RSpec exposing methods globally on `Module` and `main` config.disable_monkey_...
github
castwide/readapt
https://github.com/castwide/readapt
spec/readapt/variable_spec.rb
Ruby
mit
45
master
338
RSpec.describe Readapt::Variable do it 'structures non-empty arrays' do foo = ['foo'] var = Readapt::Variable.new('foo', foo) expect(var.reference).not_to eq(0) end it 'structures non-empty hashes' do foo = { bar: 'bar' } var = Readapt::Variable.new('foo', foo) expect(var.reference).not_t...