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 | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/sampling_handler.rb | Ruby | mit | 241 | main | 1,952 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
# Base class for sampling request handlers
# Provides access to sample object, guards, and helper methods
#
# @example Basic sampling handler
# class MySamplingHandler < RubyLLM::MCP::Handlers::SamplingHandler... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/options.rb | Ruby | mit | 241 | main | 2,699 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides option management with defaults and validation
module Options
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
#... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/sampling_actions.rb | Ruby | mit | 241 | main | 2,704 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides action methods and utilities for sampling request handlers
module SamplingActions
attr_reader :sample
protected
# Accept the sampling request with a response
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/model_filtering.rb | Ruby | mit | 241 | main | 954 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides model filtering functionality for sampling handlers
module ModelFiltering
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/approval_actions.rb | Ruby | mit | 241 | main | 1,315 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides action methods for human-in-the-loop approval handlers
module ApprovalActions
attr_reader :approval_id, :tool_name, :parameters
protected
# Approve the tool exe... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/guard_checks.rb | Ruby | mit | 241 | main | 2,112 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides guard method functionality to validate before execution
module GuardChecks
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/tool_filtering.rb | Ruby | mit | 241 | main | 1,339 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides tool filtering functionality (allow/deny lists)
module ToolFiltering
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/elicitation_actions.rb | Ruby | mit | 241 | main | 1,207 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides action methods for elicitation request handlers
module ElicitationActions
attr_reader :elicitation
protected
# Accept the elicitation with structured response
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/async_execution.rb | Ruby | mit | 241 | main | 2,489 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides async execution capabilities for handlers
module AsyncExecution
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/registry_integration.rb | Ruby | mit | 241 | main | 1,765 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides integration with approval and elicitation registries
module RegistryIntegration
protected
# Store approval context in registry
# @param id [String] approval ID
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/lifecycle.rb | Ruby | mit | 241 | main | 2,548 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides lifecycle hook management (before_execute, after_execute)
# and orchestrates the execution flow
module Lifecycle
def self.included(base)
base.extend(ClassMethods)... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/logging.rb | Ruby | mit | 241 | main | 321 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides access to MCP logger
module Logging
protected
# Access to logger
def logger
RubyLLM::MCP.logger
end
end
end
end
end
end |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/timeouts.rb | Ruby | mit | 241 | main | 1,381 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides timeout handling for async operations
module Timeouts
def self.included(base)
base.extend(ClassMethods)
end
module ClassMethods
# Registe... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | lib/ruby_llm/mcp/handlers/concerns/error_handling.rb | Ruby | mit | 241 | main | 718 | # frozen_string_literal: true
module RubyLLM
module MCP
module Handlers
module Concerns
# Provides error handling and logging for handler execution
module ErrorHandling
# Wrap call with error handling
def call
super
rescue StandardError => e
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/prompts/streamable_prompt_call.rb | Ruby | mit | 241 | main | 752 | # frozen_string_literal: true
require "bundler/setup"
require "ruby_llm/mcp"
require "debug"
require "dotenv"
Dotenv.load
RubyLLM.configure do |config|
config.openai_api_key = ENV.fetch("OPENAI_API_KEY", nil)
end
# Test with streamable HTTP transport
client = RubyLLM::MCP.client(
name: "streamable_mcp",
trans... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/utilities/progress.rb | Ruby | mit | 241 | main | 697 | # frozen_string_literal: true
require "bundler/setup"
require "ruby_llm/mcp"
require "debug"
require "dotenv"
Dotenv.load
RubyLLM.configure do |config|
config.openai_api_key = ENV.fetch("OPENAI_API_KEY", nil)
end
RubyLLM::MCP.configure do |config|
config.log_level = Logger::ERROR
end
# Test with streamable HTT... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/oauth/custom_storage.rb | Ruby | mit | 241 | main | 7,298 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Example demonstrating Custom Storage for OAuth tokens
# Shows how to implement your own storage backend (database, Redis, file, etc.)
# This example uses an enhanced in-memory storage with persistence simulation
# Usage: ruby examples/oauth/custom_storage.rb
require... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/oauth/browser_oauth.rb | Ruby | mit | 241 | main | 2,999 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Example demonstrating Browser OAuth flow
# This is the simplest OAuth approach - automatically opens browser and handles callback
# Usage: ruby examples/oauth/browser_oauth.rb
require "bundler/setup"
require "ruby_llm/mcp"
# Configure MCP logging (optional)
RubyLLM... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/oauth/standard_oauth.rb | Ruby | mit | 241 | main | 4,251 | #!/usr/bin/env ruby
# frozen_string_literal: true
# Example demonstrating Standard OAuth flow
# This approach gives you full control over the authorization flow
# Useful for web applications or when you need custom callback handling
# Usage: ruby examples/oauth/standard_oauth.rb
require "bundler/setup"
require "ruby_... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/resources/list_resources.rb | Ruby | mit | 241 | main | 669 | # frozen_string_literal: true
require "bundler/setup"
require "ruby_llm/mcp"
require "debug"
require "dotenv"
Dotenv.load
RubyLLM.configure do |config|
config.openai_api_key = ENV.fetch("OPENAI_API_KEY", nil)
end
client = RubyLLM::MCP.client(
name: "streamable_mcp",
transport_type: :streamable,
config: {
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/tools/sse_mcp_with_gpt.rb | Ruby | mit | 241 | main | 918 | # frozen_string_literal: true
require "bundler/setup"
require "ruby_llm/mcp"
require "debug"
require "dotenv"
Dotenv.load
RubyLLM.configure do |config|
config.openai_api_key = ENV.fetch("OPENAI_API_KEY", nil)
end
client = RubyLLM::MCP.client(
name: "local_mcp",
transport_type: :sse,
config: {
url: "http... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/tools/streamable_mcp.rb | Ruby | mit | 241 | main | 1,057 | # frozen_string_literal: true
require "bundler/setup"
require "ruby_llm/mcp"
require "debug"
require "dotenv"
Dotenv.load
RubyLLM.configure do |config|
config.openai_api_key = ENV.fetch("OPENAI_API_KEY", nil)
end
# Test with streamable HTTP transport
client = RubyLLM::MCP.client(
name: "streamable_mcp",
trans... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/tools/local_mcp.rb | Ruby | mit | 241 | main | 1,386 | # frozen_string_literal: true
require "bundler/setup"
require "ruby_llm/mcp"
require "debug"
require "dotenv"
Dotenv.load
RubyLLM.configure do |config|
config.openai_api_key = ENV.fetch("OPENAI_API_KEY", nil)
end
RubyLLM::MCP.configure do |config|
config.log_level = Logger::ERROR
end
# Test with filesystem MCP... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/tools/sse_mcp_tool_call.rb | Ruby | mit | 241 | main | 502 | # frozen_string_literal: true
require "bundler/setup"
require "ruby_llm/mcp"
require "debug"
require "dotenv"
Dotenv.load
RubyLLM.configure do |config|
config.openai_api_key = ENV.fetch("OPENAI_API_KEY", nil)
end
client = RubyLLM::MCP.client(
name: "local_mcp",
transport_type: :sse,
config: {
url: "http... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/Gemfile | Ruby | mit | 241 | main | 679 | # frozen_string_literal: true
source "https://rubygems.org"
# Bundle edge Rails instead: gem "rails", github: "rails/rails", branch: "main"
gem "rails", "~> 8.1.2"
# Use sqlite3 as the database for Active Record
gem "sqlite3", ">= 2.1"
# Use the Puma web server [https://github.com/puma/puma]
gem "puma", ">= 5.0"
gem ... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/test/test_helper.rb | Ruby | mit | 241 | main | 441 | # frozen_string_literal: true
ENV["RAILS_ENV"] ||= "test"
require_relative "../config/environment"
require "rails/test_help"
module ActiveSupport
class TestCase
# Run tests in parallel with specified workers
parallelize(workers: :number_of_processors)
# Setup all fixtures in test/fixtures/*.yml for all... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/test/integration/mcp_items_flow_test.rb | Ruby | mit | 241 | main | 3,112 | # frozen_string_literal: true
require "test_helper"
class McpItemsFlowTest < ActionDispatch::IntegrationTest
FakeClient = Struct.new(:items_response, :embed_response, :created_response, :completed_response, :error,
keyword_init: true) do
def list_items(include_completed: true)
ra... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/test/services/mcp_app_client_test.rb | Ruby | mit | 241 | main | 1,512 | # frozen_string_literal: true
require "test_helper"
class McpAppClientTest < ActiveSupport::TestCase
DATA_FILE = Rails.root.join("..", "test_server", "data", "items.json")
NODE_MODULES = Rails.root.join("..", "test_server", "node_modules")
setup do
skip("Run ../bin/setup first to install test_server depend... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/config/application.rb | Ruby | mit | 241 | main | 1,492 | # frozen_string_literal: true
require_relative "boot"
require "rails"
# Pick the frameworks you want:
require "active_model/railtie"
# require "active_job/railtie"
require "active_record/railtie"
# require "active_storage/engine"
require "action_controller/railtie"
# require "action_mailer/railtie"
# require "action_... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/config/ci.rb | Ruby | mit | 241 | main | 649 | # frozen_string_literal: true
# Run using bin/ci
CI.run do
step "Setup", "bin/setup --skip-server"
step "Tests: Rails", "bin/rails test"
step "Tests: Seeds", "env RAILS_ENV=test bin/rails db:seed:replant"
# Optional: Run system tests
# step "Tests: System", "bin/rails test:system"
# Optional: set a gre... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/config/routes.rb | Ruby | mit | 241 | main | 373 | # frozen_string_literal: true
Rails.application.routes.draw do
get "up" => "rails/health#show", as: :rails_health_check
root "mcp_items#index"
post "mcp_items", to: "mcp_items#create", as: :mcp_items
patch "mcp_items/:id/complete", to: "mcp_items#complete", as: :complete_mcp_item
patch "mcp_items/:id/toggl... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/config/initializers/ruby_llm_mcp.rb | Ruby | mit | 241 | main | 235 | # frozen_string_literal: true
RubyLLM::MCP.configure do |config|
config.log_level = Rails.env.production? ? Logger::WARN : Logger::INFO
config.logger = Rails.logger
config.config_path = Rails.root.join("config", "mcps.yml")
end |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/config/environments/development.rb | Ruby | mit | 241 | main | 1,996 | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Make code changes take effect immediately without server restart.
config.enable_reloading = true
# Do not eager lo... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/config/environments/test.rb | Ruby | mit | 241 | main | 1,885 | # frozen_string_literal: true
# The test environment is used exclusively to run your application's
# test suite. You never need to work with it otherwise. Remember that
# your test database is "scratch space" for the test suite and is wiped
# and recreated between test runs. Don't rely on the data there!
Rails.applic... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/config/environments/production.rb | Ruby | mit | 241 | main | 2,700 | # frozen_string_literal: true
require "active_support/core_ext/integer/time"
Rails.application.configure do
# Settings specified here will take precedence over those in config/application.rb.
# Code is not reloaded between requests.
config.enable_reloading = false
# Eager load code on boot for better perfor... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/app/controllers/application_controller.rb | Ruby | mit | 241 | main | 235 | # frozen_string_literal: true
class ApplicationController < ActionController::Base
# Only allow modern browsers supporting webp images, web push, badges, import maps, CSS nesting, and CSS :has.
allow_browser versions: :modern
end |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/app/controllers/mcp_items_controller.rb | Ruby | mit | 241 | main | 2,994 | # frozen_string_literal: true
class McpItemsController < ApplicationController
class_attribute :client_factory, default: -> { McpAppClient.new }
def index
@items = mcp_app_client.list_items
@open_items = @items.reject { |item| item["done"] }
@completed_items = @items.select { |item| item["done"] }
... |
github | patvice/ruby_llm-mcp | https://github.com/patvice/ruby_llm-mcp | examples/mcp_app/rails_app/app/services/mcp_app_client.rb | Ruby | mit | 241 | main | 1,153 | # frozen_string_literal: true
class McpAppClient
def list_items(include_completed: true)
payload = with_tool_call("list_items", include_completed: include_completed)
payload.fetch("items")
end
def render_items_embed
with_tool_call("render_items_embed")
end
def create_item(description)
with_... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | uniform_notifier.gemspec | Ruby | mit | 241 | master | 1,419 | # frozen_string_literal: true
$LOAD_PATH.push File.expand_path('lib', __dir__)
require 'uniform_notifier/version'
Gem::Specification.new do |s|
s.name = 'uniform_notifier'
s.version = UniformNotifier::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Richard Huang']
s.email = ['... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | Rakefile | Ruby | mit | 241 | master | 607 | # frozen_string_literal: true
require 'bundler'
Bundler::GemHelper.install_tasks
require 'rake'
require 'rdoc/task'
require 'rspec'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec) do |spec|
spec.pattern = 'spec/**/*_spec.rb'
end
RSpec::Core::RakeTask.new('spec:progress') do |spec|
spec.rspec_opt... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier.rb | Ruby | mit | 241 | master | 1,894 | # frozen_string_literal: true
require 'uniform_notifier/base'
require 'uniform_notifier/errors'
require 'uniform_notifier/javascript_alert'
require 'uniform_notifier/javascript_console'
require 'uniform_notifier/honeybadger'
require 'uniform_notifier/xmpp'
require 'uniform_notifier/rails_logger'
require 'uniform_notif... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/airbrake.rb | Ruby | mit | 241 | master | 481 | # frozen_string_literal: true
class UniformNotifier
class AirbrakeNotifier < Base
class << self
def active?
!!UniformNotifier.airbrake
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
opt = {}
opt = UniformNotifier.... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/bugsnag.rb | Ruby | mit | 241 | master | 713 | # frozen_string_literal: true
class UniformNotifier
class BugsnagNotifier < Base
class << self
def active?
!!UniformNotifier.bugsnag
end
protected
def _out_of_channel_notify(data)
exception = Exception.new(data[:title])
exception.set_backtrace(data[:backtrace]) i... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/appsignal.rb | Ruby | mit | 241 | master | 754 | # frozen_string_literal: true
class UniformNotifier
class AppsignalNotifier < Base
class << self
def active?
!!UniformNotifier.appsignal
end
protected
def _out_of_channel_notify(data)
opt = UniformNotifier.appsignal.is_a?(Hash) ? UniformNotifier.appsignal : {}
e... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/rollbar.rb | Ruby | mit | 241 | master | 549 | # frozen_string_literal: true
class UniformNotifier
class RollbarNotifier < Base
DEFAULT_LEVEL = 'info'
class << self
def active?
!!UniformNotifier.rollbar
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
exception = E... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/customized_logger.rb | Ruby | mit | 241 | master | 572 | # frozen_string_literal: true
class UniformNotifier
class CustomizedLogger < Base
class << self
@logger = nil
def active?
@logger
end
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
@logger.warn message
end
def setup(logdev)... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/base.rb | Ruby | mit | 241 | master | 1,058 | # frozen_string_literal: true
class UniformNotifier
class Base
class << self
def active?
false
end
def inline_notify(data)
return unless active?
# For compatibility to the old protocol
data = { title: data } if data.is_a?(String)
_inline_notify(data)
... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/rails_logger.rb | Ruby | mit | 241 | master | 332 | # frozen_string_literal: true
class UniformNotifier
class RailsLogger < Base
class << self
def active?
UniformNotifier.rails_logger
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
Rails.logger.warn message
end
en... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/opentelemetry.rb | Ruby | mit | 241 | master | 460 | # frozen_string_literal: true
class UniformNotifier
class OpenTelemetryNotifier < Base
class << self
def active?
!!UniformNotifier.opentelemetry
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
exception = Exception.new(mes... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/sentry.rb | Ruby | mit | 241 | master | 484 | # frozen_string_literal: true
class UniformNotifier
class SentryNotifier < Base
class << self
def active?
!!UniformNotifier.sentry
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
opt = {}
opt = UniformNotifier.sent... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/raise.rb | Ruby | mit | 241 | master | 493 | # frozen_string_literal: true
class UniformNotifier
class Raise < Base
class << self
def active?
defined?(@exception_class) ? @exception_class : false
end
def setup_connection(exception_class)
@exception_class = exception_class == true ? Exception : exception_class
end
... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/javascript_alert.rb | Ruby | mit | 241 | master | 503 | # frozen_string_literal: true
class UniformNotifier
class JavascriptAlert < Base
class << self
def active?
!!UniformNotifier.alert
end
protected
def _inline_notify(data)
message = data.values.compact.join("\n")
options = UniformNotifier.alert.is_a?(Hash) ? Unifor... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/slack.rb | Ruby | mit | 241 | master | 1,165 | # frozen_string_literal: true
class UniformNotifier
class Slack < Base
POSSIBLE_OPTIONS = %i[username channel].freeze
class << self
@slack = nil
def active?
@slack
end
def setup_connection(config = {})
webhook_url, options = parse_config(config)
fail_connect... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/terminal_notifier.rb | Ruby | mit | 241 | master | 640 | # frozen_string_literal: true
class UniformNotifier
class TerminalNotifier < Base
class << self
def active?
!!UniformNotifier.terminal_notifier
end
protected
def _out_of_channel_notify(data)
unless defined?(::TerminalNotifier)
begin
require 'termina... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/javascript_console.rb | Ruby | mit | 241 | master | 892 | # frozen_string_literal: true
class UniformNotifier
class JavascriptConsole < Base
class << self
def active?
!!UniformNotifier.console
end
protected
def _inline_notify(data)
message = data.values.compact.join("\n")
options = UniformNotifier.console.is_a?(Hash) ? ... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/xmpp.rb | Ruby | mit | 241 | master | 1,588 | # frozen_string_literal: true
class UniformNotifier
class Xmpp < Base
class << self
@receiver = nil
@xmpp = nil
@password = nil
def active?
@xmpp
end
def setup_connection(xmpp_information)
return unless xmpp_information
require 'xmpp4r'
@xmp... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | lib/uniform_notifier/honeybadger.rb | Ruby | mit | 241 | master | 571 | # frozen_string_literal: true
class UniformNotifier
class HoneybadgerNotifier < Base
class << self
def active?
!!UniformNotifier.honeybadger
end
protected
def _out_of_channel_notify(data)
message = data.values.compact.join("\n")
opt = {}
opt = UniformNot... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/appsignal_spec.rb | Ruby | mit | 241 | master | 3,247 | # frozen_string_literal: true
require 'spec_helper'
class Appsignal
# mock AppSignal
end
RSpec.describe UniformNotifier::AppsignalNotifier do
it 'should not notify appsignal' do
expect(UniformNotifier::AppsignalNotifier.out_of_channel_notify(title: 'notify appsignal')).to be_nil
end
it 'should notify ap... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/javascript_console_spec.rb | Ruby | mit | 241 | master | 2,270 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::JavascriptConsole do
it 'should not notify message' do
expect(UniformNotifier::JavascriptConsole.inline_notify(title: 'javascript console!')).to be_nil
end
it 'should notify message' do
UniformNotifier.console = true
... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/terminal_notifier_spec.rb | Ruby | mit | 241 | master | 971 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::TerminalNotifier do
it 'should not notify terminal-notifier when disabled' do
expect(UniformNotifier::TerminalNotifier.out_of_channel_notify(title: 'notify terminal')).to be_nil
end
it "should raise an exception when termin... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/xmpp_spec.rb | Ruby | mit | 241 | master | 2,400 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::Xmpp do
it 'should not notify xmpp' do
expect(UniformNotifier::Xmpp.out_of_channel_notify(title: 'notify xmpp')).to be_nil
end
it 'should notify xmpp without online status' do
jid = double('jid')
xmpp = double('xmpp... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/rollbar_spec.rb | Ruby | mit | 241 | master | 826 | # frozen_string_literal: true
require 'spec_helper'
class Rollbar
# mock Rollbar
end
RSpec.describe UniformNotifier::RollbarNotifier do
it 'should not notify rollbar' do
expect(UniformNotifier::RollbarNotifier.out_of_channel_notify(title: 'notify rollbar')).to be_nil
end
it 'should notify rollbar' do
... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/rails_logger_spec.rb | Ruby | mit | 241 | master | 609 | # frozen_string_literal: true
require 'spec_helper'
class Rails
# mock Rails
end
RSpec.describe UniformNotifier::RailsLogger do
it 'should not notify rails logger' do
expect(UniformNotifier::RailsLogger.out_of_channel_notify(title: 'notify rails logger')).to be_nil
end
it 'should notify rails logger' do... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/bugsnag_spec.rb | Ruby | mit | 241 | master | 2,992 | # frozen_string_literal: true
require 'spec_helper'
class Bugsnag
# mock Bugsnag
end
RSpec.describe UniformNotifier::BugsnagNotifier do
let(:notification_data) { {} }
let(:report) { double('Bugsnag::Report') }
before do
allow(report).to receive(:severity=)
allow(report).to receive(:add_tab)
allow... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/airbrake_spec.rb | Ruby | mit | 241 | master | 836 | # frozen_string_literal: true
require 'spec_helper'
class Airbrake
# mock Airbrake
end
RSpec.describe UniformNotifier::AirbrakeNotifier do
it 'should not notify airbrake' do
expect(UniformNotifier::AirbrakeNotifier.out_of_channel_notify(title: 'notify airbrake')).to be_nil
end
it 'should notify airbrake... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/raise_spec.rb | Ruby | mit | 241 | master | 994 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::Raise do
it 'should not notify message' do
expect(UniformNotifier::Raise.out_of_channel_notify(title: 'notification')).to be_nil
end
it 'should raise error of the default class' do
UniformNotifier.raise = true
expec... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/customized_logger_spec.rb | Ruby | mit | 241 | master | 739 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::CustomizedLogger do
it 'should not notify to customized logger' do
expect(UniformNotifier::CustomizedLogger.out_of_channel_notify(title: 'notify rails logger')).to be_nil
end
it 'should notify to customized logger' do
l... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/slack_spec.rb | Ruby | mit | 241 | master | 2,072 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::Slack do
context 'not enabled' do
it 'should not notify slack' do
expect_any_instance_of(Slack::Notifier).to_not receive(:ping)
expect(UniformNotifier::Slack.out_of_channel_notify(title: 'notify slack')).to be_nil
... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/opentelemetry_spec.rb | Ruby | mit | 241 | master | 1,090 | # frozen_string_literal: true
require 'spec_helper'
class OpenTelemetry
class Trace
# mock OpenTelemetry
end
end
RSpec.describe UniformNotifier::OpenTelemetryNotifier do
it 'should not notify OpenTelemetry' do
expect(UniformNotifier::OpenTelemetryNotifier.out_of_channel_notify(title: 'notify otel')).to... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/sentry_spec.rb | Ruby | mit | 241 | master | 814 | # frozen_string_literal: true
require 'spec_helper'
class Sentry
# mock Sentry
end
RSpec.describe UniformNotifier::SentryNotifier do
it 'should not notify sentry' do
expect(UniformNotifier::SentryNotifier.out_of_channel_notify(title: 'notify sentry')).to be_nil
end
it 'should notify sentry' do
expec... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/base_spec.rb | Ruby | mit | 241 | master | 772 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::Base do
context '#inline_channel_notify' do
before { allow(UniformNotifier::Base).to receive(:active?).and_return(true) }
it 'should keep the compatibility' do
expect(UniformNotifier::Base).to receive(:_inline_notify).... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/javascript_alert_spec.rb | Ruby | mit | 241 | master | 1,265 | # frozen_string_literal: true
require 'spec_helper'
RSpec.describe UniformNotifier::JavascriptAlert do
it 'should not notify message' do
expect(UniformNotifier::JavascriptAlert.inline_notify(title: 'javascript alert!')).to be_nil
end
it 'should notify message' do
UniformNotifier.alert = true
expect... |
github | flyerhzm/uniform_notifier | https://github.com/flyerhzm/uniform_notifier | spec/uniform_notifier/honeybadger_spec.rb | Ruby | mit | 241 | master | 882 | # frozen_string_literal: true
require 'spec_helper'
class Honeybadger
# mock Honeybadger
end
RSpec.describe UniformNotifier::HoneybadgerNotifier do
it 'should not notify honeybadger' do
expect(UniformNotifier::HoneybadgerNotifier.out_of_channel_notify(title: 'notify honeybadger')).to be_nil
end
it 'shou... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | rubyvis.gemspec | Ruby | bsd-2-clause | 241 | master | 631 | # -*- encoding: utf-8 -*-
require_relative "lib/rubyvis/version.rb"
Gem::Specification.new do |s|
s.name = "rubyvis"
s.version = Rubyvis::VERSION
s.platform = Gem::Platform::RUBY
s.authors = ['Claudio Bustos']
s.email = []
s.homepage = "http://rubygems.org/gems/rubyvis"
s.summary = "Rubyvis"
s.descript... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | Rakefile | Ruby | bsd-2-clause | 241 | master | 846 | # -*- ruby -*-
$:.unshift(File.expand_path(File.dirname(__FILE__)+"/lib"))
$:.unshift(File.expand_path(File.dirname(__FILE__)))
require 'rubygems'
require 'rubyvis'
require 'rspec'
require 'rspec/core/rake_task'
require './lib/rspec/expectations/differ'
require 'bundler'
Bundler::GemHelper.install_tasks
desc "Publ... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis.rb | Ruby | bsd-2-clause | 241 | master | 2,408 | require 'date'
require 'ostruct'
require 'rexml/document'
require 'rexml/formatters/default'
require 'pp'
require 'rubyvis/version'
require 'rubyvis/internals'
require 'rubyvis/vector'
require 'rubyvis/sceneelement'
require 'rubyvis/property'
require 'rubyvis/nest'
require 'rubyvis/flatten'
require 'rubyvis/javascri... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rspec/expectations/differ_spec.rb | Ruby | bsd-2-clause | 241 | master | 2,399 | require 'spec_helper'
require 'ostruct'
module RSpec
module Fixtures
class Animal
def initialize(name,species)
@name,@species = name,species
end
def inspect
<<-EOA
<Animal
name=#{@name},
species=#{@species}
>
EOA
end
end
end
end
describe "Diff" do
bef... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rspec/expectations/differ.rb | Ruby | bsd-2-clause | 241 | master | 2,092 | # Borrowed from:
# https://github.com/pcreux/rspec-expectations/commit/b5f8d5ab7c9a3e8d470c6ec3241179be0b78f3ac#diff-1
require 'diff/lcs'
require 'diff/lcs/hunk'
require 'pp'
module RSpec
module Expectations
class Differ
# This is snagged from diff/lcs/ldiff.rb (which is a commandline tool)
def di... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/internals.rb | Ruby | bsd-2-clause | 241 | master | 6,569 | module Rubyvis
# :section: /pv-internals.js
@@id=0
# Returns a locally-unique positive id.
def self.id
@@id+=1
end
# Return a proc wrapping specific constant
def self.functor(f)
(f.is_a? Proc) ? f : lambda {f}
end
##
# :section: /data/Arrays.js
##
# A private variant of Array.map that... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/format.rb | Ruby | bsd-2-clause | 241 | master | 348 | module Rubyvis
def self.Format
Rubyvis::Format
end
module Format
def self.re(s)
s.gsub(/[\\\^\$\*\+\?\[\]\(\)\.\{\}]/, "\\$&")
end
def self.number
Format::Number.new
end
def self.date(pattern)
Format::Date.new(pattern)
end
end
end
require 'rubyvis/format/number'
re... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/scale.rb | Ruby | bsd-2-clause | 241 | master | 1,061 | module Rubyvis
def self.Scale
Rubyvis::Scale
end
module Scale
def self.quantitative(*args)
Quantitative.new(*args)
end
def self.linear(*args)
Linear.new(*args)
end
def self.ordinal(*args)
Ordinal.new(*args)
end
def self.log(*args)
Log.new(*args)
end
... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/mark.rb | Ruby | bsd-2-clause | 241 | master | 37,376 | module Rubyvis
# Constructs a new mark with default properties. Marks, with the exception of
# the root panel, are not typically constructed directly; instead, they are
# added to a panel or an existing mark via Mark#add
#
# Represents a data-driven graphical mark. The +Mark+ class is
# the base class for a... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/transform.rb | Ruby | bsd-2-clause | 241 | master | 362 | module Rubyvis
def self.Transform
Rubyvis::Transform
end
class Transform
attr_accessor :k,:x,:y
def initialize
@k=1
@x=0
@y=0
end
def translate(x,y)
v=Transform.new
v.k=self.k
v.x=self.k*x+self.x
v.y=self.k*y+self.y
v
end
def self.identi... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/layout.rb | Ruby | bsd-2-clause | 241 | master | 1,274 | module Rubyvis
def self.Layout
Rubyvis::Layout
end
class Layout < Rubyvis::Panel
@properties=Panel.properties.dup
def build_properties(s,properties)
layout_build_properties(s,properties)
end
def layout_build_properties(s,properties)
mark_build_properties(s, properties)
en... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/vector.rb | Ruby | bsd-2-clause | 241 | master | 3,649 | module Rubyvis
# Returns a {@link pv.Vector} for the specified <i>x</i> and <i>y</i>
# coordinate. This is a convenience factory method, equivalent to <tt>new
# pv.Vector(x, y)</tt>.
#
# @see pv.Vector
# @param {number} x the <i>x</i> coordinate.
# @param {number} y the <i>y</i> coordinate.
# @returns {... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/histogram.rb | Ruby | bsd-2-clause | 241 | master | 918 | module Rubyvis
def self.histogram(data,f=nil)
Rubyvis::Histogram.new(data,f)
end
class Histogram
module Bin
attr_accessor :x, :dx, :y
end
attr_accessor :frequency
attr_reader :data
attr_reader :f
def initialize(data,f=nil)
@data=data
@f=f
@frequency=true
end... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/flatten.rb | Ruby | bsd-2-clause | 241 | master | 3,958 | module Rubyvis
# Returns a {@link pv.Flatten} operator for the specified map. This is a
# convenience factory method, equivalent to <tt>new pv.Flatten(map)</tt>.
def self.flatten(map)
Flatten.new(map)
end
# Represents a flatten operator for the specified array. Flattening
# allows hierarchical maps to... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/sceneelement.rb | Ruby | bsd-2-clause | 241 | master | 3,786 | module Rubyvis
# Scene element
# Store information about each scene.
# On javascript, is an Array with custom properties.
class SceneElement # :nodoc:
def initialize
@scenes=Array.new
end
include Enumerable
attr_accessor :visible
## ACCESSOR
## If you implement new accessor on a ... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/javascript_behaviour.rb | Ruby | bsd-2-clause | 241 | master | 1,999 | class TrueClass
# Return 1
def to_i
1
end
end
class FalseClass
# Return 0
def to_i
0
end
end
# :stopdoc:
unless Object.public_method_defined? :instance_exec
class Object
module InstanceExecHelper; end
include InstanceExecHelper
def instance_exec(*args, &block) # :nodoc:
begin
... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/dom.rb | Ruby | bsd-2-clause | 241 | master | 11,226 | module Rubyvis
# Returns a Rubyvis::Dom operator for the given map. This is a convenience
# factory method, equivalent to Rubyvis::Dom.new(map). To apply the operator
# and retrieve the root node, call Rubyvis::Dom.root() to retrieve all nodes
# flattened, use Rubyvis::Dom.nodes
#
# @see pv.Dom
# @param m... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/nest.rb | Ruby | bsd-2-clause | 241 | master | 6,547 | module Rubyvis
##
# Returns a Nest operator for the specified array. This is a
# convenience factory method, equivalent to <tt>Nest.new(array)</tt>.
#
# @see Rubyvis::Nest
# @param {array} array an array of elements to nest.
# @returns {Nest} a nest operator for the specified array.
##
def self.nest(a... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/property.rb | Ruby | bsd-2-clause | 241 | master | 259 | module Rubyvis
class Property
attr_accessor :name, :id, :value, :_type, :fixed
def initialize(opts=Hash.new)
@id=opts[:id]
@name=opts[:name]
@value=opts[:value]
@_type=opts[:_type]
@fixed=opts[:fixed]
end
end
end |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/color/colors.rb | Ruby | bsd-2-clause | 241 | master | 5,512 | module Rubyvis
#
# :section: colors/Ramp.js
# Returns a linear color ramp from the specified <tt>start</tt> color to the
# specified <tt>end</tt> color. The color arguments may be specified either as
# <tt>string</tt>s or as Rubyvis::Color. This is equivalent to:
#
# <pre> pv.Scale.linear().domai... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/color/color.rb | Ruby | bsd-2-clause | 241 | master | 13,595 | module Rubyvis
# Returns the Rubyvis::Color for the specified color format string. Colors
# may have an associated opacity, or alpha channel.
# Color formats are specified by CSS Color Modular Level 3,
# using either in RGB or HSL color space. For example:<ul>
#
# <li>#f00 // #rgb
# <li>#ff0000 // #rrgg... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/scale/quantitative.rb | Ruby | bsd-2-clause | 241 | master | 15,300 | module Rubyvis
# Represents an abstract quantitative scale; a function that performs a
# numeric transformation. This class is typically not used directly; see one of
# the quantitative scale implementations (linear, log, root, etc.)
# instead. <style type="text/css">sub{line-height:0}</style> A quantitative
... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/scale/log.rb | Ruby | bsd-2-clause | 241 | master | 1,914 | module Rubyvis
class Scale::Log < Rubyvis::Scale::Quantitative
def initialize(*args)
super(*args)
raise(ArgumentError,"left side of domain should be >0") if(@d.first<=0)
@b=nil
@_p=nil
base(10)
end
def log(x)
Math.log(x) / @_p.to_f
end
def pow(y)
@b**y
... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/scale/ordinal.rb | Ruby | bsd-2-clause | 241 | master | 7,777 | module Rubyvis
# Represents an ordinal scale. <style
# type="text/css">sub{line-height:0}</style> An ordinal scale represents a
# pairwise mapping from <i>n</i> discrete values in the input domain to
# <i>n</i> discrete values in the output range. For example, an ordinal scale
# might map a domain of species ... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/layout/arc.rb | Ruby | bsd-2-clause | 241 | master | 6,775 | module Rubyvis
class Layout
# Alias for Rubyvis::Layout::Arc
def self.Arc
Rubyvis::Layout::Arc
end
# Implements a layout for arc diagrams. An arc diagram is a network
# visualization with a one-dimensional layout of nodes, using circular arcs to
# render links between nodes. For und... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/layout/treemap.rb | Ruby | bsd-2-clause | 241 | master | 11,606 | module Rubyvis
class Layout
# Alias for Rubyvis::Layout::Treemap
def self.Treemap
Rubyvis::Layout::Treemap
end
# Implements a space-filling rectangular layout, with the hierarchy
# represented via containment. Treemaps represent nodes as boxes, with child
# nodes placed within parent ... |
github | clbustos/rubyvis | https://github.com/clbustos/rubyvis | lib/rubyvis/layout/matrix.rb | Ruby | bsd-2-clause | 241 | master | 7,139 | module Rubyvis
class Layout
# Alias for Rubyvis::Layout::Matrix
def self.Matrix
Rubyvis::Layout::Matrix
end
# Implements a network visualization using a matrix view. This is, in
# effect, a visualization of the graph's <i>adjacency matrix</i>: the cell at
# row <i>i</i>, column <i>j</i>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.