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
tmatilai/homebrew-terraforms
https://github.com/tmatilai/homebrew-terraforms
Casks/terraform-1.7.2.rb
Ruby
mit
179
master
543
cask "terraform-1.7.2" do version "1.7.2" name "Terraform" homepage "https://www.terraform.io/" case Hardware::CPU.arch when :x86_64 url "https://releases.hashicorp.com/terraform/1.7.2/terraform_1.7.2_darwin_amd64.zip" sha256 "dad2fd54b3dda89b39978dcd27c8c62e13010efdc0507a04b6ad57257b57085e" when ...
github
tmatilai/homebrew-terraforms
https://github.com/tmatilai/homebrew-terraforms
Formula/chtf.rb
Ruby
mit
179
master
1,430
class Chtf < Formula desc "Terraform version switcher" homepage "https://github.com/tmatilai/chtf#readme" url "https://github.com/tmatilai/chtf/archive/refs/tags/v2.3.0.tar.gz" sha256 "d44606fe55ba2903f00b1f93ba411d4e06aa02978a577d8491e477c28a8a47bc" license "MIT" head "https://github.com/tmatilai/chtf.gi...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
rumoji.gemspec
Ruby
mit
179
master
758
# -*- encoding: utf-8 -*- lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'rumoji/version' Gem::Specification.new do |gem| gem.name = "rumoji" gem.version = Rumoji::VERSION gem.authors = ["Mark Wunsch"] gem.email = ["mark@m...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji.rb
Ruby
mit
179
master
1,015
# -*- encoding: utf-8 -*- require "rumoji/version" require "rumoji/emoji" require 'stringio' module Rumoji extend self # Transform emoji into its cheat-sheet code (convert each entry to string first to handle hash values) def encode(str) str.to_s.gsub(Emoji::ALL_REGEXP) do |match| if emoji = Emoji.fin...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji/emoji.rb
Ruby
mit
179
master
1,965
# -*- encoding: utf-8 -*- module Rumoji class Emoji attr_reader :name, :string def initialize(string, symbols, name = nil) @string = string @codepoints = string.codepoints @cheat_codes = [symbols].flatten @name = name || @cheat_codes.first.to_s.upcase.gsub("_", " ") end def ...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji/emoji/people.rb
Ruby
mit
179
master
16,384
# -*- encoding: utf-8 -*- require 'rumoji/emoji' require 'set' module Rumoji class Emoji PEOPLE = SortedSet[ self.new("\u{1F604}", [:smile, :simple_smile], "SMILING FACE WITH OPEN MOUTH AND SMILING EYES"), self.new("\u{1F606}", [:laughing], "SMILING FACE WITH OPEN MOUTH AND TIGHTLY-CLOSED EYES"), ...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji/emoji/objects.rb
Ruby
mit
179
master
14,616
# -*- encoding: utf-8 -*- require 'rumoji/emoji' require 'set' module Rumoji class Emoji OBJECTS = SortedSet[ self.new("\u{1F38D}", [:bamboo], "PINE DECORATION"), # "Japanese new year's door decoration self.new("\u{1F49D}", [:gift_heart], "HEART WITH RIBBON"), self.new("\u{1F38E}", [:dolls], "...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji/emoji/nature.rb
Ruby
mit
179
master
7,843
# -*- encoding: utf-8 -*- require 'rumoji/emoji' require 'set' module Rumoji class Emoji NATURE = SortedSet[ self.new("\u{2600}" , [:sunny], "BLACK SUN WITH RAYS"), self.new("\u{2614}" , [:umbrella], "UMBRELLA WITH RAIN DROPS"), self.new("\u{2601}" , [:cloud]), self.new("\u{2744}" , [:sn...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji/emoji/newmoji.rb
Ruby
mit
179
master
16,241
# New Emojis. Up to date with emoji-js.json as of 2/16/2018 # TODO: Recategorize emojis to the appropriate files. require 'rumoji/emoji' require 'set' module Rumoji class Emoji NEWMOJI = SortedSet[ self.new(Regexp.escape("\u{002A FE0F 20E3}"), [:keycap_star]), self.new("\u{1F1FA 1F1F3}", [:"flag-un"...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji/emoji/places.rb
Ruby
mit
179
master
29,260
# -*- encoding: utf-8 -*- require 'rumoji/emoji' require 'set' module Rumoji class Emoji PLACES = SortedSet[ self.new("\u{1f6a1}", [:aerial_tramway]), self.new("\u{2708}" , [:airplane]), self.new("\u{1f691}", [:ambulance]), self.new("\u{2693}" , [:anchor]), self.new("\u{1f69b}", [:...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji/emoji/food.rb
Ruby
mit
179
master
3,049
require 'rumoji/emoji' require 'set' module Rumoji class Emoji FOOD = SortedSet[ self.new("\u{1F34E}", [:apple]), self.new("\u{1f34c}", [:banana]), self.new("\u{1f37a}", [:beer]), self.new("\u{1f37b}", [:beers]), self.new("\u{1f35e}", [:bread]), self.new("\u{1f370}", [:cake]),...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
lib/rumoji/emoji/symbols.rb
Ruby
mit
179
master
11,332
# -*- encoding: utf-8 -*- require 'rumoji/emoji' require 'set' module Rumoji class Emoji SYMBOLS = SortedSet[ self.new("\u{1f4af}", [:"100"]), self.new("\u{1f522}", [:"1234"]), self.new("\u{1f170}", [:a]), self.new("\u{1f18e}", [:ab]), self.new("\u{1f524}", [:abc]), self.new(...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
spec/rumoji_spec.rb
Ruby
mit
179
master
6,580
# -*- encoding: utf-8 -*- require 'rumoji' require 'minitest/spec' require 'minitest/autorun' describe Rumoji do before do @poop = "💩" @smile = "😄" @zero = "0️⃣" @us = "🇺🇸" @non_potable_water = "🚱" @man_man_boy_boy = "👨‍👨‍👦‍👦" end describe "#encode" do it "transforms emoji i...
github
mwunsch/rumoji
https://github.com/mwunsch/rumoji
spec/rumoji/emoji_spec.rb
Ruby
mit
179
master
3,066
# -*- encoding: utf-8 -*- require 'rumoji' require 'minitest/spec' require 'minitest/autorun' describe Rumoji::Emoji do let(:symbols) { [:hankey, :poop, :shit] } let(:emoji_name) { "PILE OF POO" } let(:poo_string) { "\u{1F4A9}" } subject do Rumoji::Emoji.new(poo_string, symbols, emoji_name) end it("...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
ralyxa.gemspec
Ruby
mit
179
master
1,372
lib = File.expand_path('../lib', __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require 'ralyxa/version' Gem::Specification.new do |spec| spec.name = 'ralyxa' spec.version = Ralyxa::VERSION spec.authors = ['Sam Morgan'] spec.email = ['samm@makersacademy.com'] ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa.rb
Ruby
mit
179
master
684
require 'ralyxa/version' require 'ralyxa/configuration' require 'ralyxa/register_intents' require 'ralyxa/skill' module Ralyxa class << self attr_accessor :configuration def configure yield configuration if block_given? end def method_missing(m, *args, &block) if configuration.respond_t...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/configuration.rb
Ruby
mit
179
master
323
module Ralyxa class Configuration attr_accessor :validate_requests, :require_secure_urls def initialize @validate_requests = true @require_secure_urls = true end def validate_requests? validate_requests end def require_secure_urls? require_secure_urls end end e...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/register_intents.rb
Ruby
mit
179
master
1,322
require_relative './skill' module Ralyxa class RegisterIntents DEFAULT_INTENTS_DIRECTORY = './intents'.freeze def initialize(intents_directory, alexa_skill_class) @intents_directory = intents_directory @alexa_skill_class = alexa_skill_class end def self.run(intents_directory = DEFAULT_I...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/handler.rb
Ruby
mit
179
master
1,264
require_relative './response_builder' require_relative './response_entities/card' # Handler Base Class. Each Intent Handler inherits from this, and overwrites the #handle method. module Ralyxa class Handler def initialize(request) @request = request end def handle raise NotImplementedError ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_builder.rb
Ruby
mit
179
master
1,777
require 'json' require_relative './response_entities/response' module Ralyxa class ResponseBuilder def initialize(response_class, output_speech_class, reprompt_class, options) @response_class = response_class @output_speech_class = output_speech_class @reprompt_class = reprompt_class ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/skill.rb
Ruby
mit
179
master
1,393
require_relative './request_entities/request' require_relative './handler' # Routes an incoming request to the correct Handler. module Ralyxa class Skill @handlers = {} def initialize(request) @request = request end def handle handler = self.class.handlers[@request.intent_name] ha...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/request_entities/request.rb
Ruby
mit
179
master
1,599
require 'json' require 'forwardable' require 'alexa_verifier' require_relative './user' module Ralyxa module RequestEntities class Request extend Forwardable INTENT_REQUEST_TYPE = 'IntentRequest'.freeze def_delegator :@user, :id, :user_id def_delegator :@user, :access_token, :user_access...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/request_entities/user.rb
Ruby
mit
179
master
539
module Ralyxa module RequestEntities class User attr_reader :id, :access_token def initialize(id:, access_token: nil) @id = id @access_token = access_token end def self.build(request) user_hash = request.dig('session', 'user') || request.dig('context', 'System', '...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/output_speech.rb
Ruby
mit
179
master
851
module Ralyxa module ResponseEntities class OutputSpeech DEFAULT_RESPONSE_TEXT = 'Hello World'.freeze DEFAULT_RESPONSE_SSML = '<speak>Hello World</speak>'.freeze def initialize(speech, ssml) @speech = speech @ssml = ssml end def to_h {}.tap do |output_spee...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/response.rb
Ruby
mit
179
master
1,843
require_relative './output_speech' require_relative './reprompt' require_relative './directives' module Ralyxa module ResponseEntities class Response def initialize(output_speech, reprompt, session_attributes, end_session, start_over, card, directives) @output_speech = output_speech @r...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/reprompt.rb
Ruby
mit
179
master
549
module Ralyxa module ResponseEntities class Reprompt def initialize(reprompt_speech, reprompt_ssml) @reprompt_speech = reprompt_speech @reprompt_ssml = reprompt_ssml end def to_h {}.tap do |reprompt| reprompt[:outputSpeech] = Ralyxa::ResponseEntities::OutputS...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/card.rb
Ruby
mit
179
master
2,715
require_relative '../errors' module Ralyxa module ResponseEntities class Card LINK_ACCOUNT_CARD_TYPE = 'LinkAccount'.freeze SIMPLE_CARD_TYPE = 'Simple'.freeze STANDARD_CARD_TYPE = 'Standard'.freeze def initialize(options) @options = options end def self.as_...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/directives/audio_player.rb
Ruby
mit
179
master
2,491
require_relative './audio_player/clear_queue' require_relative './audio_player/play' require_relative './audio_player/stop' module Ralyxa module ResponseEntities module Directives class AudioPlayer class << self def play(url, token, speech: nil, card: nil, offset_in_milliseconds: 0, expec...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/directives/audio/audio_item.rb
Ruby
mit
179
master
435
module Ralyxa module ResponseEntities module Directives module Audio class AudioItem def initialize(stream) @stream = stream end def to_h {}.tap do |audio_item| audio_item['stream'] = @stream.to_h end end ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/directives/audio/stream.rb
Ruby
mit
179
master
1,332
module Ralyxa module ResponseEntities module Directives module Audio class Stream def initialize(url, token, offset_in_milliseconds = 0, expected_previous_token = nil) raise Ralyxa::UnsecureUrlError, "Audio streams must be served from at an SSL-enabled (HTTPS) endpoint. Your cu...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/directives/audio_player/play.rb
Ruby
mit
179
master
967
module Ralyxa module ResponseEntities module Directives class AudioPlayer class Play CLEAR_ENQUEUE = 'CLEAR_ENQUEUE'.freeze ENQUEUE = 'ENQUEUE'.freeze REPLACE_ALL = 'REPLACE_ALL'.freeze REPLACE_ENQUEUED = 'REPLACE_ENQUEUED'.freeze d...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/directives/audio_player/clear_queue.rb
Ruby
mit
179
master
780
module Ralyxa module ResponseEntities module Directives class AudioPlayer class ClearQueue CLEAR_ENQUEUED = 'CLEAR_ENQUEUED'.freeze CLEAR_ALL = 'CLEAR_ALL'.freeze def initialize(behaviour = Ralyxa::ResponseEntities::Directives::AudioPlayer::ClearQueue::CLEAR_ENQUEUED) ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
lib/ralyxa/response_entities/directives/audio_player/stop.rb
Ruby
mit
179
master
350
module Ralyxa module ResponseEntities module Directives class AudioPlayer class Stop def to_h {}.tap do |audio_player| audio_player['type'] = 'AudioPlayer.Stop' end end def self.as_hash new.to_h end en...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa_spec.rb
Ruby
mit
179
master
1,516
require "spec_helper" RSpec.describe Ralyxa do it "has a version number" do expect(Ralyxa::VERSION).not_to be nil end describe '#configure' do before :each do Ralyxa.configuration = Ralyxa::Configuration.new end context 'with a block' do it 'sets configuration values as expected' do...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/spec_helper.rb
Ruby
mit
179
master
870
require 'simplecov' SimpleCov.start do add_filter %r{^/spec/} end require 'ralyxa' require 'vcr' require 'timecop' RSpec.configure do |config| config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mocks| mo...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/support/shared_examples.rb
Ruby
mit
179
master
511
shared_examples 'a configuration option' do |option| it "allows #{option} to be configured" do configuration = described_class.new boolean_method = "#{option.to_s}?".to_sym setter_method = "#{option.to_s}=".to_sym expect(configuration.send(boolean_method)).to eq(true) configuration.send(setter...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_builder_spec.rb
Ruby
mit
179
master
2,917
require 'ralyxa/response_builder' RSpec.describe Ralyxa::ResponseBuilder do let(:response_class) { double(:"Ralyxa::Response", as_hash: {}) } let(:output_speech) { double(:alexa_output_speech) } let(:output_speech_class) { double(:"Ralyxa::OutputSpeech", as_hash: output_speech) } let(:reprompt) ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/configuration_spec.rb
Ruby
mit
179
master
591
require 'ralyxa/configuration' RSpec.describe Ralyxa::Configuration do subject(:ralyxa_configuration) { Ralyxa::Configuration.new } describe '#initialize' do it 'sets default configuration values' do expect(ralyxa_configuration.validate_requests).to eq(true) expect(ralyxa_configuration.require_sec...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/handler_spec.rb
Ruby
mit
179
master
2,508
require 'ralyxa/handler' RSpec.describe Ralyxa::Handler do let(:request) { double(:request) } let(:intent_proc) { Proc.new { |object| object } } subject(:handler) { described_class.new(request) } describe '#handle' do it 'is initially undefined' do expect { handler.handle }.to raise_error NotImp...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/register_intents_spec.rb
Ruby
mit
179
master
927
require 'ralyxa/register_intents' RSpec.describe Ralyxa::RegisterIntents do describe '#run' do it 'registers intents declared inside the "intents" directory to the skill' do fixtures_path = "./spec/fixtures/intents" fixtures_files = Dir.glob("#{fixtures_path}/*.rb") fixtures = fixtures_f...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/skill_spec.rb
Ruby
mit
179
master
2,464
require 'ralyxa/skill' RSpec.describe Ralyxa::Skill do describe '.handlers' do it 'starts with zero registered handlers' do expect(described_class.handlers.length).to be_zero end end describe '.intent' do it 'defines a handler, which responds to #handle by executing a given Proc within its sco...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/request_entities/user_spec.rb
Ruby
mit
179
master
1,780
require 'ralyxa/request_entities/user' RSpec.describe Ralyxa::RequestEntities::User do describe '.build' do it 'builds a user object from a request' do ralyxa_request = { "session" => { "user" => { "userId" => "someUserId", "accessToken" => "someAccessToken" ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/request_entities/request_spec.rb
Ruby
mit
179
master
6,419
require 'ralyxa/request_entities/request' RSpec.describe Ralyxa::RequestEntities::Request, vcr: true do describe '#intent_name' do it 'returns the IntentName from the request' do stubbed_request = stub_sinatra_request({ "request": { "type": "IntentRequest", "intent": { ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/response_spec.rb
Ruby
mit
179
master
5,063
require 'ralyxa/response_entities/response' RSpec.describe Ralyxa::ResponseEntities::Response do let(:output_speech) { { type: "PlainText", text: "Hello World" } } subject(:response) { described_class.as_hash(output_speech: output_speech) } describe '.as_hash' do it 'returns an empty response if no options...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/card_spec.rb
Ruby
mit
179
master
2,729
require 'ralyxa/response_entities/card' RSpec.describe Ralyxa::ResponseEntities::Card do subject(:card) { described_class.as_hash } describe '.as_hash' do it 'generates a Simple card given only a title and body' do expected_result = { type: "Simple", title: "Hello Card", conte...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/output_speech_spec.rb
Ruby
mit
179
master
1,590
require 'ralyxa/response_entities/output_speech' RSpec.describe Ralyxa::ResponseEntities::OutputSpeech do describe 'building a speech component of a response' do it 'defaults to plain text and "Hello World"' do expected_output_speech = { type: "PlainText", text: "Hello World" } ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/reprompt_spec.rb
Ruby
mit
179
master
1,736
require 'ralyxa/response_entities/reprompt' RSpec.describe Ralyxa::ResponseEntities::Reprompt do describe 'building a reprompt component of a response' do it 'defaults to plain text and "Hello World"' do expected_reprompt = { outputSpeech: { type: "PlainText", text: "Hello World...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/directives/audio_player_spec.rb
Ruby
mit
179
master
4,625
require_relative '../../../spec_helper' RSpec.describe Ralyxa::ResponseEntities::Directives::AudioPlayer do let(:card) { Ralyxa::ResponseEntities::Card.as_hash('Hello World', 'This is a test', 'https://placehold.it/100', 'https://placehold.it/200') } describe '.play' do context 'with only the required attribu...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/directives/audio/audio_item_spec.rb
Ruby
mit
179
master
833
require_relative '../../../../spec_helper' RSpec.describe Ralyxa::ResponseEntities::Directives::Audio::AudioItem do subject(:audio_item) { described_class.new(Ralyxa::ResponseEntities::Directives::Audio::Stream.new('http://localhost', 'token')) } describe '#to_h' do it 'generates the expected hash' do e...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/directives/audio/stream_spec.rb
Ruby
mit
179
master
2,018
require_relative '../../../../spec_helper' RSpec.describe Ralyxa::ResponseEntities::Directives::Audio::Stream do describe '#initialize' do it 'raises a Ralyxa::UnsecureUrlError if the url is not served over HTTPS and Ralyxa is configured to use secure URLs only' do Ralyxa.require_secure_urls = true ...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/directives/audio_player/stop_spec.rb
Ruby
mit
179
master
435
require_relative '../../../../spec_helper' RSpec.describe Ralyxa::ResponseEntities::Directives::AudioPlayer::Stop do describe '#to_h' do it 'generates the expected hash' do expect(described_class.new.to_h).to eq({ "type" => "AudioPlayer.Stop" }) end end describe '.as_hash' do it 'generates the...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/directives/audio_player/play_spec.rb
Ruby
mit
179
master
1,722
require_relative '../../../../spec_helper' RSpec.describe Ralyxa::ResponseEntities::Directives::AudioPlayer::Play do describe 'constants' do it 'has the expected constant values' do expect(described_class::REPLACE_ALL).to eq('REPLACE_ALL') expect(described_class::ENQUEUE).to eq('ENQUEUE') expec...
github
sjmog/ralyxa
https://github.com/sjmog/ralyxa
spec/ralyxa/response_entities/directives/audio_player/clear_queue_spec.rb
Ruby
mit
179
master
1,007
require_relative '../../../../spec_helper' RSpec.describe Ralyxa::ResponseEntities::Directives::AudioPlayer::ClearQueue do describe 'constants' do it 'has the expected constant values' do expect(described_class::CLEAR_ENQUEUED).to eq('CLEAR_ENQUEUED') expect(described_class::CLEAR_ALL).to eq('CLEAR_A...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
dry-auto_inject.gemspec
Ruby
mit
179
main
1,593
# frozen_string_literal: true # This file is synced from hanakai-rb/repo-sync. To update it, edit repo-sync.yml. lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "dry/auto_inject/version" Gem::Specification.new do |spec| spec.name = "dry-auto_inject" ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/spec_helper.rb
Ruby
mit
179
main
459
# frozen_string_literal: true require_relative "support/coverage" begin require "byebug" rescue LoadError; end require_relative "support/rspec" require "dry-auto_inject" Dir.glob(Pathname.new(__dir__).join("support", "**", "*.rb")).each do |file| require_relative file end module Test def self.remove_constan...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/dry/auto_inject_spec.rb
Ruby
mit
179
main
13,819
# frozen_string_literal: true RSpec.describe Dry::AutoInject do def assert_valid_object(object) expect(object.one).to eq 1 expect(object.two).to eq 2 expect(object.three).to eq 3 end before do module Test AutoInject = Dry::AutoInject({one: 1, two: 2, "namespace.three" => 3}) end end ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/kwargs_spec.rb
Ruby
mit
179
main
923
# frozen_string_literal: true RSpec.describe "kwargs" do before do module Test AutoInject = Dry::AutoInject(one: "dep 1") end end it "supports explicit injection of falsey values" do obj = Class.new do include Test::AutoInject[:one] end expect(obj.new.one).to eq "dep 1" expe...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/inheritance_spec.rb
Ruby
mit
179
main
1,555
# frozen_string_literal: true RSpec.describe "Inheritance" do before do module Test AutoInject = Dry::AutoInject({one: 1, two: 2, "namespace.three" => 3}) end end context "auto-inject included from outside a class with an existing initializer to manage ivar assignment" do let(:class_with_initi...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/args_injection_spec.rb
Ruby
mit
179
main
879
# frozen_string_literal: true RSpec.describe "argument parameters" do describe "inheritance" do describe "module included with an initialize accepting anonymous splat and passing all args through to super (which accepts no args)" do before do module Test AutoInject = Dry::AutoInject({one:...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/chaining_injectors_spec.rb
Ruby
mit
179
main
554
# frozen_string_literal: true RSpec.describe "chaining injectors" do before do module Test AutoInject = Dry::AutoInject({one: 1, two: 2}) end end let(:class_with_inject) { Class.new do include Test::AutoInject.args.kwargs[:one, :two] end } it "supports chaining injectors" do ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/hash/super_initialize_spec.rb
Ruby
mit
179
main
1,239
# frozen_string_literal: true RSpec.describe "hash / super #initialize method" do before do module Test AutoInject = Dry::AutoInject(one: "dep 1") end end describe "super #initialize using on dependencies set in the child class" do let(:child_class) { Class.new(parent_class) do i...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/hash/inheritance/existing_ivars_before_initialize_spec.rb
Ruby
mit
179
main
1,375
# frozen_string_literal: true RSpec.describe "kwargs / inheritance / instance variables set before #initialize" do before do module Test AutoInject = Dry::AutoInject(configuration: "configuration", another_dep: "another_dep") end end let(:framework_class) { Class.new do def self.new(opti...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/hash/inheritance/parent_class_injections_spec.rb
Ruby
mit
179
main
1,556
# frozen_string_literal: true RSpec.describe "hash / inheritance / parent class also auto-injecting" do before do module Test AutoInject = Dry::AutoInject(one: "dep 1", two: "dep 2").hash end end describe "differing injections" do let(:parent_class) { Class.new do include Test::A...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/args/super_initialize_spec.rb
Ruby
mit
179
main
1,181
# frozen_string_literal: true RSpec.describe "args / super #initialize method" do before do module Test AutoInject = Dry::AutoInject(one: "dep 1") end end describe "super #initialize using on dependencies set in the child class" do let(:child_class) { Class.new(parent_class) do i...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/kwargs/super_initialize_spec.rb
Ruby
mit
179
main
4,014
# frozen_string_literal: true RSpec.describe "kwargs / super #initialize method" do before do module Test AutoInject = Dry::AutoInject(one: "dep 1") end end describe "super #initialize using dependencies set in the child class" do context "super #initialize without parameters" do let(:pa...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/kwargs/inheritance/parent_class_injections_spec.rb
Ruby
mit
179
main
2,129
# frozen_string_literal: true RSpec.describe "kwargs / inheritance / parent class also auto-injecting" do before do module Test AutoInject = Dry::AutoInject(one: "dep 1", two: "dep 2") end end describe "differing injections" do let(:parent_class) { Class.new do include Test::Auto...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/integration/kwargs/inheritance/existing_ivars_before_initialize_spec.rb
Ruby
mit
179
main
1,299
# frozen_string_literal: true RSpec.describe "kwargs / inheritance / instance variables set before #initialize" do before do module Test AutoInject = Dry::AutoInject(configuration: "configuration", another_dep: "another_dep") end end let(:framework_class) { Class.new do def self.new(conf...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/unit/builder_spec.rb
Ruby
mit
179
main
757
# frozen_string_literal: true require "dry/auto_inject/builder" RSpec.describe Dry::AutoInject::Builder do describe "#respond_to?" do subject(:builder) { Dry::AutoInject::Builder.new({}, strategies: {kwargs: Object.new}) } it "responds to strategy names" do expect(builder.respond_to?(:kwargs)).to be ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/unit/dependency_map_spec.rb
Ruby
mit
179
main
2,703
# frozen_string_literal: true require "dry/auto_inject/dependency_map" RSpec.describe Dry::AutoInject::DependencyMap do describe "#initialize" do subject(:dependency_map) { Dry::AutoInject::DependencyMap.new(*dependencies) } let(:dependencies) { ["namespace.one", "namespace.two"] } it "registers specif...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/unit/injector_spec.rb
Ruby
mit
179
main
877
# frozen_string_literal: true require "dry/auto_inject/injector" RSpec.describe Dry::AutoInject::Builder do describe "#respond_to?" do subject(:injector) { Dry::AutoInject::Injector.new({}, double("strategy"), builder: builder) } let(:builder) { Dry::AutoInject::Builder.new({}, strategies: {kwargs: double(...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
spec/unit/method_parameters_spec.rb
Ruby
mit
179
main
1,495
# frozen_string_literal: true require "dry/auto_inject/method_parameters" RSpec.describe Dry::AutoInject::MethodParameters do let(:parameters) { described_class } describe ".of" do it "returns method parameters" do klass = Class.new { def foo(a, b = nil, *c, d:, e: nil, **f, &g); end } ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject.rb
Ruby
mit
179
main
1,762
# frozen_string_literal: true require "zeitwerk" require "dry/core" module Dry module AutoInject def self.loader @loader ||= ::Zeitwerk::Loader.new.tap do |loader| root = ::File.expand_path("..", __dir__) loader.tag = "dry-auto_inject" loader.inflector = ::Zeitwerk::GemInflector.ne...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/strategies.rb
Ruby
mit
179
main
441
# frozen_string_literal: true module Dry module AutoInject class Strategies extend Core::Container::Mixin # @api public def self.register_default(name, strategy) register name, strategy register :default, strategy end register :args, proc { Strategies::Args } ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/builder.rb
Ruby
mit
179
main
771
# frozen_string_literal: true module Dry module AutoInject class Builder # @api private attr_reader :container # @api private attr_reader :strategies # This clashes with the hash strategy undef hash def initialize(container, options = {}) @container = containe...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/method_parameters.rb
Ruby
mit
179
main
1,555
# frozen_string_literal: true module Dry module AutoInject # @api private class MethodParameters PASS_THROUGH = [ [%i[rest]], [%i[rest], %i[keyrest]], [%i[rest *]], [%i[rest *], %i[keyrest **]] ].freeze def self.of(obj, name) ::Enumerator.new do |y| ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/dependency_map.rb
Ruby
mit
179
main
1,310
# frozen_string_literal: true module Dry module AutoInject DuplicateDependencyError = ::Class.new(::StandardError) DependencyNameInvalid = ::Class.new(::StandardError) VALID_NAME = /([a-z_][a-zA-Z_0-9]*)$/ class DependencyMap def initialize(*dependencies) @map = {} dependenci...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/injector.rb
Ruby
mit
179
main
779
# frozen_string_literal: true require "dry/auto_inject/strategies" module Dry module AutoInject class Injector < ::BasicObject # @api private attr_reader :container # @api private attr_reader :strategy # @api private attr_reader :builder define_method(:respond_to?, :...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/strategies/kwargs.rb
Ruby
mit
179
main
3,194
# frozen_string_literal: true module Dry module AutoInject class Strategies # @api private class Kwargs < Constructor private def define_new class_mod.class_exec(container, dependency_map) do |container, dependency_map| map = dependency_map.to_h def...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/strategies/constructor.rb
Ruby
mit
179
main
1,400
# frozen_string_literal: true module Dry module AutoInject class Strategies class Constructor < ::Module ClassMethods = ::Class.new(::Module) InstanceMethods = ::Class.new(::Module) attr_reader :container attr_reader :dependency_map attr_reader :instance_mod ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/strategies/hash.rb
Ruby
mit
179
main
1,537
# frozen_string_literal: true module Dry module AutoInject class Strategies # @api private class Hash < Constructor private def define_new class_mod.class_exec(container, dependency_map) do |container, dependency_map| deps_map = dependency_map.to_h ...
github
dry-rb/dry-auto_inject
https://github.com/dry-rb/dry-auto_inject
lib/dry/auto_inject/strategies/args.rb
Ruby
mit
179
main
2,320
# frozen_string_literal: true module Dry module AutoInject class Strategies # @api private class Args < Constructor private def define_new class_mod.class_exec(container, dependency_map) do |container, dependency_map| deps_with_indices = dependency_map.to_h.valu...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
dry-logic.gemspec
Ruby
mit
179
main
1,657
# frozen_string_literal: true # This file is synced from hanakai-rb/repo-sync. To update it, edit repo-sync.yml. lib = File.expand_path("lib", __dir__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "dry/logic/version" Gem::Specification.new do |spec| spec.name = "dry-logic" spec.author...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
examples/basic.rb
Ruby
mit
179
main
507
# frozen_string_literal: true require "dry/logic" require "dry/logic/predicates" # rubocop:disable Style/MixinUsage include Dry::Logic # rubocop:enable Style/MixinUsage user_present = Rule::Predicate.build(Predicates[:key?]).curry(:user) has_min_age = Operations::Key.new(Rule::Predicate.build(Predicates[:gt?]).curr...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/spec_helper.rb
Ruby
mit
179
main
483
# frozen_string_literal: true require_relative "support/coverage" require_relative "support/warnings" begin require "pry-byebug" rescue LoadError; end require "dry/logic" require "pathname" SPEC_ROOT = Pathname(__dir__) Dir[SPEC_ROOT.join("shared/**/*.rb")].each(&method(:require)) Dir[SPEC_ROOT.join("support/**/...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/shared/predicate.rb
Ruby
mit
179
main
342
# frozen_string_literal: true require "dry/logic/builder" # TODO: Merge with {operation}? RSpec.shared_examples "predicate" do before { extend Dry::Logic::Builder } let(:predicate) { build(&expression) } let(:args) { defined?(input) ? [input] : [] } subject { predicate.call(*args).success? } it { is_expecte...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/shared/predicates.rb
Ruby
mit
179
main
1,391
# frozen_string_literal: true require "dry/logic/predicates" RSpec.shared_examples "predicates" do let(:nil?) { Dry::Logic::Predicates[:nil?] } let(:array?) { Dry::Logic::Predicates[:array?] } let(:empty?) { Dry::Logic::Predicates[:empty?] } let(:str?) { Dry::Logic::Predicates[:str?] } let(:true?) { Dry...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/shared/built_rule.rb
Ruby
mit
179
main
1,092
# frozen_string_literal: true require "dry/logic/builder" RSpec.shared_examples "built rule" do |rule_type, *args| subject(:built_rule) { Dry::Logic::Builder.call(&expression) } let(:rule_type) { rule_type } case rule_type when :predicate include_examples "built rule predicate", *args else include_...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/shared/rule.rb
Ruby
mit
179
main
1,849
# frozen_string_literal: true RSpec.shared_examples_for Dry::Logic::Rule do let(:arity) { 2 } let(:predicate) { double(:predicate, arity: arity, name: predicate_name) } let(:rule_type) { described_class } let(:predicate_name) { :good? } describe "#arity" do it "returns its predicate arity" do rule...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/shared/operation.rb
Ruby
mit
179
main
310
# frozen_string_literal: true require "dry/logic/builder" RSpec.shared_examples "operation" do before { extend Dry::Logic::Builder } let(:operation) { build(&expression) } let(:args) { defined?(input) ? [input] : [] } subject { operation.call(*args).success? } it { is_expected.to eq(output) } end
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/integration/result_spec.rb
Ruby
mit
179
main
1,964
# frozen_string_literal: true RSpec.describe Dry::Logic::Result do include_context "predicates" describe "#to_s" do shared_examples_for "string representation" do it "returns string representation" do expect(rule.(input).to_s).to eql(output) end end context "with a predicate" do ...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/integration/rule_spec.rb
Ruby
mit
179
main
1,673
# frozen_string_literal: true require "dry-logic" RSpec.describe "Rules" do specify "defining an anonymous rule with an arbitrary predicate" do rule = Dry::Logic.Rule { |value| value.is_a?(Integer) } expect(rule.(1)).to be_success expect(rule[1]).to be(true) end specify "defining a conjunction" do...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/integration/builder/operation_spec.rb
Ruby
mit
179
main
8,243
# frozen_string_literal: true require_relative "../../shared/operation" RSpec.describe "operations" do describe "nested" do let(:predicate) do Dry::Logic::Builder.call do check keys: [:person] do check keys: [:age] do gt?(50) & lt?(200) end end end ...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/integration/builder/predicate_spec.rb
Ruby
mit
179
main
23,132
# frozen_string_literal: true require_relative "../../shared/predicate" RSpec.describe "predicates" do let(:input) { described_class } describe :key? do let(:expression) { ->(*) { key?(:speed) } } describe "success" do let(:output) { true } describe({speed: 100}) do it_behaves_like ...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/unit/predicates_spec.rb
Ruby
mit
179
main
990
# frozen_string_literal: true require "dry/logic/predicates" RSpec.describe Dry::Logic::Predicates do it "can be included in another module" do mod = Module.new { include Dry::Logic::Predicates } expect(mod[:key?]).to be_a(Method) end describe ".predicate" do it "defines a predicate method" do ...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/unit/rule_compiler_spec.rb
Ruby
mit
179
main
3,188
# frozen_string_literal: true require "dry/logic/rule_compiler" RSpec.describe Dry::Logic::RuleCompiler, "#call" do subject(:compiler) { described_class.new(predicates) } let(:predicates) { {key?: predicate, attr?: predicate, filled?: predicate, gt?: predicate, one: predicate} } let(...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/unit/builder_spec.rb
Ruby
mit
179
main
760
# frozen_string_literal: true RSpec.describe Dry::Logic::Builder do describe "undefined methods" do it "raises NameError" do expect do described_class.call { does_not_exist } end.to raise_error(NameError, /does_not_exist/) end end describe "leakage" do context "given a module ext...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/unit/rule_spec.rb
Ruby
mit
179
main
6,843
# frozen_string_literal: true RSpec.describe Dry::Logic::Rule do subject(:rule) { described_class.build(predicate, **options) } let(:predicate) { -> { true } } let(:options) { {} } let(:schema) do Class.new do define_method(:class, Kernel.instance_method(:class)) def respond_to_missing?(m, *...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/unit/operations/or_spec.rb
Ruby
mit
179
main
2,083
# frozen_string_literal: true RSpec.describe Dry::Logic::Operations::Or do subject(:operation) { described_class.new(left, right) } include_context "predicates" let(:left) { Dry::Logic::Rule::Predicate.build(nil?) } let(:right) { Dry::Logic::Rule::Predicate.build(gt?).curry(18) } let(:other) do Dry::L...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/unit/operations/key_spec.rb
Ruby
mit
179
main
3,819
# frozen_string_literal: true RSpec.describe Dry::Logic::Operations::Key do subject(:operation) { described_class.new(predicate, name: :user) } include_context "predicates" let(:predicate) do Dry::Logic::Rule::Predicate.build(key?).curry(:age) end describe "#call" do context "with a plain predicat...
github
dry-rb/dry-logic
https://github.com/dry-rb/dry-logic
spec/unit/operations/negation_spec.rb
Ruby
mit
179
main
1,276
# frozen_string_literal: true RSpec.describe Dry::Logic::Operations::Negation do subject(:operation) { described_class.new(is_int) } include_context "predicates" let(:is_int) { Dry::Logic::Rule::Predicate.build(int?) } describe "#call" do it "negates its rule" do expect(operation.("19")).to be_suc...