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 | jage/elk | https://github.com/jage/elk | spec/unit/client_spec.rb | Ruby | mit | 19 | master | 1,924 | # frozen_string_literal: true
require "spec_helper"
require "elk"
describe Elk::Client do
it { is_expected.to respond_to(:configure) }
it { is_expected.to respond_to(:base_url) }
it { is_expected.to respond_to(:base_domain) }
it { is_expected.to respond_to(:username) }
it { is_expected.to respond_to(:userna... |
github | jage/elk | https://github.com/jage/elk | spec/integration/number_spec.rb | Ruby | mit | 19 | master | 5,386 | # frozen_string_literal: true
require "spec_helper"
require "elk"
describe Elk::Number do
before { configure_elk }
let(:username) { "USERNAME" }
let(:password) { "PASSWORD" }
let(:basic_auth) { [username, password] }
let(:url) { "https://api.46elks.com/a1/Numbers" }
describe ".allocate" do
context "s... |
github | jage/elk | https://github.com/jage/elk | spec/integration/sms_spec.rb | Ruby | mit | 19 | master | 7,195 | # frozen_string_literal: true
require "spec_helper"
require "elk"
describe Elk::SMS do
before { configure_elk }
let(:username) { "USERNAME" }
let(:password) { "PASSWORD" }
let(:basic_auth) { [username, password] }
let(:url) { "https://api.46elks.com/a1/SMS" }
describe ".send" do
let(:from) { "+46... |
github | jage/elk | https://github.com/jage/elk | lib/elk.rb | Ruby | mit | 19 | master | 1,026 | # frozen_string_literal: true
require "forwardable"
# Base module
# Used for to configure username and password through Elk.configure
module Elk
class << self
extend Forwardable
# Delegate methods to client
delegated_methods = [
:username,
:username=,
:password,
:password=,
... |
github | jage/elk | https://github.com/jage/elk | lib/elk/sms.rb | Ruby | mit | 19 | master | 3,641 | # frozen_string_literal: true
require "time"
module Elk
# Used to send SMS through 46elks SMS-gateway
class SMS
attr_reader :from, :to, :message, :message_id, :created_at,
:loaded_at, :direction, :status, :client #:nodoc:
def initialize(parameters) #:nodoc:
set_parameters(parameters... |
github | jage/elk | https://github.com/jage/elk | lib/elk/util.rb | Ruby | mit | 19 | master | 617 | # frozen_string_literal: true
require "json"
module Elk
module Util
def verify_parameters(parameters, required_parameters)
missing_parameters = (required_parameters - parameters.keys)
unless missing_parameters.empty?
message = missing_parameters.map { |s| ":#{s}" }.join(', ')
raise E... |
github | jage/elk | https://github.com/jage/elk | lib/elk/client.rb | Ruby | mit | 19 | master | 2,027 | # frozen_string_literal: true
require "rest_client"
module Elk
class Client
# Base domain for 46elks API
BASE_DOMAIN = "api.46elks.com".freeze
# API version supported
API_VERSION = "a1".freeze
# API Username from 46elks.com
attr_accessor :username
# API Password from 46elks.com
attr... |
github | jage/elk | https://github.com/jage/elk | lib/elk/number.rb | Ruby | mit | 19 | master | 3,061 | # frozen_string_literal: true
require "time"
module Elk
# Allocate and manage numbers used for SMS/MMS/Voice
class Number
attr_reader :number_id, :number, :capabilities, :loaded_at, :client #:nodoc:
attr_accessor :country, :sms_url, :voice_start_url #:nodoc:
def initialize(parameters) #:nodoc:
... |
github | jage/elk | https://github.com/jage/elk | lib/elk/error.rb | Ruby | mit | 19 | master | 519 | # frozen_string_literal: true
module Elk
# When the authentication can't be done
class AuthError < RuntimeError; end
# Raised when the API server isn't working
class ServerError < RuntimeError; end
# Generic exception when 46elks API gives a response Elk can't parse
class BadResponse < RuntimeError; end
... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | Rakefile | Ruby | mit | 19 | master | 206 | # frozen_string_literal: true
require 'bundler/gem_tasks'
require 'rspec/core/rake_task'
RSpec::Core::RakeTask.new(:spec)
require 'rubocop/rake_task'
RuboCop::RakeTask.new
task default: %i[spec rubocop] |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | rubocop-sorted_methods_by_call.gemspec | Ruby | mit | 19 | master | 1,865 | # frozen_string_literal: true
require_relative 'lib/rubocop/sorted_methods_by_call/version'
Gem::Specification.new do |spec|
spec.name = 'rubocop-sorted_methods_by_call'
spec.version = RuboCop::SortedMethodsByCall::VERSION
spec.authors = ['unurgunite']
spec.email = ['senpaiguru1488@gmail.com']
spec.summary... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | rakelib/docs.rake | Ruby | mit | 19 | master | 2,017 | # frozen_string_literal: true
require 'English'
require 'yard'
require 'fileutils'
GEM_NAME = Bundler.load_gemspec(Dir.glob('*.gemspec').first).name
DOCS_REPO_NAME = "#{GEM_NAME}_docs".freeze
DOCS_REPO_PATH = "../#{DOCS_REPO_NAME}".freeze
namespace :docs do # rubocop:disable Metrics/BlockLength
desc 'Generate new ... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | lib/rubocop-sorted_methods_by_call.rb | Ruby | mit | 19 | master | 210 | # frozen_string_literal: true
require_relative 'rubocop/sorted_methods_by_call/plugin'
require_relative 'rubocop/sorted_methods_by_call/version'
require_relative 'rubocop/cop/sorted_methods_by_call/waterfall' |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | lib/rubocop/sorted_methods_by_call/plugin.rb | Ruby | mit | 19 | master | 2,213 | # frozen_string_literal: true
require 'lint_roller'
require_relative 'version'
module RuboCop
module SortedMethodsByCall
# +RuboCop::SortedMethodsByCall::Plugin+ integrates this extension with RuboCop's
# plugin system via lint_roller. It declares metadata and tells RuboCop where
# to find the plugin's ... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | lib/rubocop/sorted_methods_by_call/compare.rb | Ruby | mit | 19 | master | 3,042 | # frozen_string_literal: true
module RuboCop
module SortedMethodsByCall
# +RuboCop::SortedMethodsByCall::Compare+ provides helpers to compare
# definition orders and call orders using "ordered subsequence" semantics.
# It’s used by the cop to check that called methods appear in the same
# relative or... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | lib/rubocop/sorted_methods_by_call/extensions/util.rb | Ruby | mit | 19 | master | 1,198 | # frozen_string_literal: true
module RuboCop
module SortedMethodsByCall
module Util # :nodoc:
# +RuboCop::SortedMethodsByCall::Util.deep_merge(hash, other)+ -> Hash
#
# Merges two hashes without overwriting values that share the same key.
# When a key exists in both hashes, values are acc... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | lib/rubocop/cop/sorted_methods_by_call/waterfall.rb | Ruby | mit | 19 | master | 27,257 | # frozen_string_literal: true
module RuboCop
module Cop
module SortedMethodsByCall
# Enforces "waterfall" ordering: define a method after any method
# that calls it within the same scope. Produces a top-down reading flow
# where orchestration appears before implementation details.
#
... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | spec/spec_helper.rb | Ruby | mit | 19 | master | 456 | # frozen_string_literal: true
require 'rubocop'
require 'rubocop/rspec/expect_offense'
RSpec.configure do |config|
config.include RuboCop::RSpec::ExpectOffense
# Enable flags like --only-failures and --next-failure
config.example_status_persistence_file_path = '.rspec_status'
# Disable RSpec exposing methods... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | spec/rubocop/sorted_methods_by_call/compare_spec.rb | Ruby | mit | 19 | master | 1,382 | # frozen_string_literal: true
require 'rubocop/sorted_methods_by_call/compare'
RSpec.describe RuboCop::SortedMethodsByCall::Compare do
describe '.subsequence?' do
it 'returns true for an ordered subsequence' do
arr = %i[abc foo bar a hello]
expect(described_class.subsequence?(arr, %i[foo bar hello])... |
github | unurgunite/rubocop-sorted_methods_by_call | https://github.com/unurgunite/rubocop-sorted_methods_by_call | spec/rubocop/cop/sorted_methods_by_call/waterfall_spec.rb | Ruby | mit | 19 | master | 13,333 | # frozen_string_literal: true
require 'rubocop/rspec/support'
require 'rubocop-sorted_methods_by_call'
RSpec.describe RuboCop::Cop::SortedMethodsByCall::Waterfall, :config do
let(:config) do
RuboCop::Config.new(
'SortedMethodsByCall/Waterfall' => { 'Enabled' => true }
)
end
it 'accepts waterfall ... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | page_ez.gemspec | Ruby | mit | 19 | main | 1,799 | # frozen_string_literal: true
require_relative "lib/page_ez/version"
Gem::Specification.new do |spec|
spec.name = "page_ez"
spec.version = PageEz::VERSION
spec.authors = ["Josh Clayton"]
spec.email = ["joshua.clayton@gmail.com"]
spec.summary = "PageEz is a tool to define page objects with Capybara"
spec.... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/spec_helper.rb | Ruby | mit | 19 | main | 1,136 | # frozen_string_literal: true
require "simplecov"
require "simplecov-lcov"
SimpleCov::Formatter::LcovFormatter.config do |c|
c.report_with_single_file = true
c.single_report_path = "coverage/lcov.info"
end
SimpleCov.start do
add_filter "spec/"
if ENV["CI"]
formatter SimpleCov::Formatter::LcovFormatter
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/lib/page_ez/options_spec.rb | Ruby | mit | 19 | main | 656 | require "spec_helper"
RSpec.describe PageEz::Options do
it "returns vanilla options" do
expect(described_class.merge(foo: 1)).to eq(foo: 1)
end
it "returns vanilla options with dynamic options" do
expect(described_class.merge({foo: 2}, ->(foo:) { {bar: foo} }, foo: 1)).to eq(foo: 2, bar: 1)
end
it ... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/lib/page_ez/pluralization_spec.rb | Ruby | mit | 19 | main | 1,114 | require "spec_helper"
RSpec.describe PageEz::Pluralization do
it "behaves correctly" do
aggregate_failures("words are singular/plural correctly") do
singular_and_plural_words.each do |singular, plural|
expect(described_class.new(singular)).to be_singular
expect(described_class.new(plural)).... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/lib/page_ez/configuration_spec.rb | Ruby | mit | 19 | main | 594 | require "spec_helper"
RSpec.describe PageEz::Configuration do
it "disallows invalid values for on_pluralization_mismatch" do
expect do
PageEz.configure do |config|
config.on_pluralization_mismatch = :invalid
end
end.to raise_error(ArgumentError, ":invalid must be one of [:warn, :raise, ni... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/lib/page_ez/page_spec.rb | Ruby | mit | 19 | main | 1,769 | require "spec_helper"
require "logger"
RSpec.describe PageEz::Page do
it "logs declarations" do
logger = configure_fake_logger
Class.new(PageEz::Page) do
has_one :list, "ul" do
has_many :items, "li" do
has_one :name, "span"
end
end
end
expect(logger.debugs).to ... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/has_many_ordered_spec.rb | Ruby | mit | 19 | main | 6,681 | require "spec_helper"
RSpec.describe "has_many_ordered", type: :feature do
it "allows for nested elements with the same name" do
page = build_page(<<-HTML)
<main>
<header>
<h2>Received Webhooks</h2>
</header>
<section>
<ul data-role="webhooks-list">
<li>
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/arguments_spec.rb | Ruby | mit | 19 | main | 1,718 | require "spec_helper"
RSpec.describe "Arguments" do
it "allows for different types of arguments" do
page = build_page(<<-HTML)
<h1>Hello</h1>
HTML
test_page = Class.new(PageEz::Page) do
has_one :heading, "h1"
has_one :heading_with_required_arg, "h1", ->(text) { {text: text} }
has_o... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/capybara_javascript_spec.rb | Ruby | mit | 19 | main | 5,179 | require "spec_helper"
RSpec.describe "Capybara and JavaScript", :js, type: :feature do
it "behaves as expected when using has_css? and has_no_css?" do
page = build_page(<<-HTML)
<section>
<ul>
<li>Item 1</li>
</ul>
</section>
<script type="text/javascript">
document.addEvent... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/pluralization_spec.rb | Ruby | mit | 19 | main | 1,607 | require "spec_helper"
RSpec.describe "Declarations with improper pluralization" do
it "warns when pluralization doesn't align with macro" do
logger = configure_fake_logger
PageEz.configure do |config|
config.on_pluralization_mismatch = :warn
end
Class.new(PageEz::Page) do
has_one :lists... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/capybara_overlap_spec.rb | Ruby | mit | 19 | main | 2,018 | require "spec_helper"
RSpec.describe "Declaring elements that overlap with Capybara matchers", type: :feature do
it "warns that those matchers will be used instead of the predicate methods" do
PageEz.configure do |config|
config.on_matcher_collision = :warn
end
logger = configure_fake_logger
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/has_one_spec.rb | Ruby | mit | 19 | main | 7,706 | require "spec_helper"
RSpec.describe "has_one", type: :feature do
it "generates accessors returning Capybara Elements for each declared has_one" do
page = build_page("<h1>Hello, world!</h1><p>Some description</p>")
test_page = Class.new(PageEz::Page) do
has_one :heading, "h1"
has_one :descriptio... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/composition_spec.rb | Ruby | mit | 19 | main | 2,110 | require "spec_helper"
RSpec.describe "Page object composition", type: :feature do
it "works as expected with correct nesting" do
build_page(<<-HTML)
<nav class="primary">
<ul>
<li><a data-role="home-link" href="/">Home</a></li>
</ul>
</nav>
<ul class="metrics">
<li><h3>Metr... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/has_many_spec.rb | Ruby | mit | 19 | main | 3,685 | require "spec_helper"
RSpec.describe "has_many", type: :feature do
it "generates accessors returning Capybara Elements for each declared has_many" do
page = build_page(<<-HTML)
<ul>
<li>
<span data-role='todo-name'>Buy milk</span>
<button>Done</button>
</li>
<li>
<sp... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/contains_spec.rb | Ruby | mit | 19 | main | 7,295 | require "spec_helper"
RSpec.describe "contains" do
it "pulls in everything from the corresponding PageEz::Page" do
page = build_page(<<-HTML)
<heading data-role="primary">
<h1>Application Title</h1>
</heading>
<main>
<h2>Awesome Site</h2>
</main>
<footer data-role="primary">
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/selectors_spec.rb | Ruby | mit | 19 | main | 1,251 | require "spec_helper"
RSpec.describe "Selectors" do
it "allows string selectors" do
page = build_page(<<-HTML)
<h1>Hello</h1>
HTML
test_page = Class.new(PageEz::Page) do
has_one :heading, "h1"
end.new(page)
page.visit "/"
expect(test_page.heading).to have_text("Hello")
expect... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/broken_selector_spec.rb | Ruby | mit | 19 | main | 2,258 | require "spec_helper"
RSpec.describe "generating broken CSS selectors", :feature do
it "provides more context around what selector was used" do
page = build_page(<<-HTML)
<section>Bogus</section>
HTML
test_page = Class.new(PageEz::Page) do
has_one :dynamic_section
has_one :section_assumi... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/macros_with_methods_spec.rb | Ruby | mit | 19 | main | 5,535 | require "spec_helper"
RSpec.describe "Macros with methods" do
it "calls the method with the appropriate arguments" do
page = build_page(<<-HTML)
<section data-id="1">
<heading>Section 1</heading>
</section>
<section data-id="2">
<heading>Section 2</heading>
</section>
HTML
t... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/smoke_spec.rb | Ruby | mit | 19 | main | 4,388 | require "spec_helper"
RSpec.describe "Smoke spec", type: :feature do
let(:page) do
AppGenerator
.new(title: "Application Title")
.route("/", "<h1>Hello, world!</h1>")
.run
end
it "is successful" do
hello_page = Class.new(PageEz::Page) do
has_one :heading, "h1"
end
visit ... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/form_spec.rb | Ruby | mit | 19 | main | 631 | require "spec_helper"
RSpec.describe "Form interactions", type: :feature do
it "works with selects" do
page = build_page(<<-HTML)
<form>
<select id="options">
<option value="1">One</option>
<option value="2">Two</option>
</select>
</form>
HTML
test_page = Class.new(Pa... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/override_container_spec.rb | Ruby | mit | 19 | main | 4,517 | require "spec_helper"
RSpec.describe "overriding container" do
it "works by scoping the first portion" do
page = build_page(<<-HTML)
<div data-role="slot-1">
<section>
<heading>
<h2>Heading 1</h2>
</heading>
<div data-role="content">
<p>Paragraph 1</p>
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/features/delegation_name_collisions_spec.rb | Ruby | mit | 19 | main | 3,197 | require "spec_helper"
RSpec.describe "Delegation name collisions" do
it "raises when a name collides" do
expect do
Class.new(PageEz::Page) do
has_one :header do
has_one :application_title, "h1"
end
delegate :application_title, to: :header
def application_title
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/support/fake_logger.rb | Ruby | mit | 19 | main | 599 | module FakeLogger
def configure_fake_logger
logger = Class.new do
attr_reader :debugs, :infos, :warns
def initialize
reset
end
def debug(message)
@debugs << message
end
def info(message)
@infos << message
end
def warn(message)
@wa... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/support/capybara.rb | Ruby | mit | 19 | main | 326 | module CapybaraHelpers
def with_max_wait_time(seconds:)
original_wait_time = Capybara.default_max_wait_time
Capybara.default_max_wait_time = seconds
yield
ensure
Capybara.default_max_wait_time = original_wait_time
end
end
RSpec.configure do |config|
config.include CapybaraHelpers, type: :featur... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/support/app_generator.rb | Ruby | mit | 19 | main | 868 | class AppGenerator
def initialize(title: "PageEz")
@app = Class.new(Sinatra::Base)
@title = title
end
def route(path, content)
layout = <<~HTML
<!DOCTYPE html>
<html>
<head>
<title>#{title}</title>
</head>
<body>
<%= yield %>
</body>
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | spec/support/matchers/contain_in_order.rb | Ruby | mit | 19 | main | 314 | RSpec::Matchers.define :contain_in_order do |*expected|
match do |actual|
actual_ = actual.dup
result = expected.map do |expected_|
actual_.index(expected_).tap do |index|
actual_.delete_at(index) if index
end
end
result == result.compact && result == result.sort
end
end |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez.rb | Ruby | mit | 19 | main | 1,773 | # frozen_string_literal: true
require_relative "page_ez/version"
require_relative "page_ez/errors"
require_relative "page_ez/configuration"
require_relative "page_ez/null_logger"
require_relative "page_ez/delegates_to"
require_relative "page_ez/parameters"
require_relative "page_ez/selector_evaluator"
require_relative... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/errors.rb | Ruby | mit | 19 | main | 458 | module PageEz
class Error < StandardError; end
class PluralizationMismatchError < StandardError; end
class MatcherCollisionError < StandardError; end
class DuplicateElementDeclarationError < StandardError; end
class InvalidSelectorError < StandardError; end
def self.reraise_selector_error(selector)
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/page_visitor.rb | Ruby | mit | 19 | main | 1,605 | module PageEz
class PageVisitor
def initialize
@visitors = [
Visitors::DebugVisitor.new,
Visitors::RegisteredNameVisitor.new,
Visitors::MacroPluralizationVisitor.new,
Visitors::MatcherCollisionVisitor.new
]
end
def begin_block_evaluation
@visitors.each do... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/selector_evaluator.rb | Ruby | mit | 19 | main | 1,883 | module PageEz
class SelectorEvaluator
def self.build(name, dynamic_options:, options:, selector:)
run_def = ->(args, target:) do
PageEz::SelectorEvaluator.new(name, args, dynamic_options: dynamic_options, options: options, selector: selector, target: target)
end
name_def = -> { name }
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/has_many_result.rb | Ruby | mit | 19 | main | 697 | module PageEz
class HasManyResult
include DelegatesTo[:@result]
def initialize(container:, selector:, options:, constructor:)
@container = container
@selector = selector
@options = options
@result = container.all(
selector,
**options
).map do |element|
co... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/delegates_to.rb | Ruby | mit | 19 | main | 771 | module PageEz
module DelegatesTo
def self.[](name)
Module.new do
define_singleton_method(:included) do |base|
base.include(Module.new.tap do |mod|
mod.class_eval %{
def method_missing(*args, **kwargs, &block)
if #{name}.respond_to?(args[0])
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/page.rb | Ruby | mit | 19 | main | 5,037 | require "capybara/dsl"
require "active_support/core_ext/class/attribute"
require "active_support/core_ext/module/delegation"
module PageEz
class Page
include DelegatesTo[:container]
class_attribute :visitor, :macro_registrar, :nested_macro, :container_base_selector
self.visitor = PageVisitor.new
se... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/has_one_result.rb | Ruby | mit | 19 | main | 270 | module PageEz
class HasOneResult
include DelegatesTo[:@result]
def initialize(container:, selector:, options:, constructor:)
@result = constructor.call(
container.find(
selector,
**options
)
)
end
end
end |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/pluralization.rb | Ruby | mit | 19 | main | 375 | require "active_support/core_ext/string/inflections"
module PageEz
class Pluralization
def initialize(word)
@word = word.to_s
end
def singularize
@word.singularize
end
def pluralize
@word.pluralize
end
def plural?
@word == pluralize && @word != singularize
e... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/parameters.rb | Ruby | mit | 19 | main | 978 | module PageEz
class Parameters
def self.build(block)
if block&.respond_to?(:parameters) && block.respond_to?(:arity)
new(block)
else
NullParameters.new
end
end
def keyword_args
@block.parameters.filter_map do |type, name|
param = Parameter.new(type, name)
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/configuration.rb | Ruby | mit | 19 | main | 859 | module PageEz
class Configuration
VALID_MISMATCH_BEHAVIORS = [:warn, :raise, nil].freeze
attr_accessor :logger
attr_reader :on_pluralization_mismatch, :on_matcher_collision
def initialize
reset
end
def on_pluralization_mismatch=(value)
if !VALID_MISMATCH_BEHAVIORS.include?(value)... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/options.rb | Ruby | mit | 19 | main | 943 | require "active_support/core_ext/hash/keys"
module PageEz
class Options
def self.merge(options, dynamic_options = nil, *args)
dynamic_options ||= -> { {} }
keys_to_extract = dynamic_options.parameters.filter_map do |type, name|
if type == :keyreq || type == :key
name
end
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/has_many_dynamic_selector.rb | Ruby | mit | 19 | main | 760 | module PageEz
module MethodGenerators
class HasManyDynamicSelector
attr_reader :selector
def initialize(name, options, &block)
@run = false
@name = name
@options = options
@block = block
end
def run(target)
return if run?
if target.method_... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/define_has_one_predicate_methods.rb | Ruby | mit | 19 | main | 1,166 | module PageEz
module MethodGenerators
class DefineHasOnePredicateMethods
def initialize(name, evaluator_class:, processor: IdentityProcessor)
@name = name
@evaluator_class = evaluator_class
@processor = processor
end
def run(target)
evaluator_class = @evaluator_c... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/has_many_ordered_dynamic_selector.rb | Ruby | mit | 19 | main | 768 | module PageEz
module MethodGenerators
class HasManyOrderedDynamicSelector
attr_reader :selector
def initialize(name, options, &block)
@run = false
@name = name
@options = options
@block = block
end
def run(target)
return if run?
if target.... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/has_one_static_selector.rb | Ruby | mit | 19 | main | 760 | module PageEz
module MethodGenerators
class HasOneStaticSelector
attr_reader :selector
def initialize(name, selector, dynamic_options, options, &block)
@name = name
@selector = selector
@evaluator_class = SelectorEvaluator.build(name, dynamic_options: dynamic_options, options:... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/has_one_dynamic_selector.rb | Ruby | mit | 19 | main | 758 | module PageEz
module MethodGenerators
class HasOneDynamicSelector
attr_reader :selector
def initialize(name, options, &block)
@run = false
@name = name
@options = options
@block = block
end
def run(target)
return if run?
if target.method_d... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/define_has_one_result_methods.rb | Ruby | mit | 19 | main | 1,004 | require_relative "identity_processor"
module PageEz
module MethodGenerators
class DefineHasOneResultMethods
def initialize(name, evaluator_class:, constructor:, processor: IdentityProcessor)
@name = name
@evaluator_class = evaluator_class
@processor = processor
@constructor ... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/has_one_composed_class.rb | Ruby | mit | 19 | main | 1,087 | module PageEz
module MethodGenerators
class HasOneComposedClass
attr_reader :selector
def initialize(name, composed_class, options, &block)
@name = name
@composed_class = composed_class
@options = options
@block = block
end
def run(target)
construc... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/has_many_static_selector.rb | Ruby | mit | 19 | main | 1,158 | module PageEz
module MethodGenerators
class HasManyStaticSelector
attr_reader :selector
def initialize(name, selector, dynamic_options, options, &block)
@name = name
@selector = selector
@block = block
@evaluator_class = SelectorEvaluator.build(name, dynamic_options: d... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/define_has_many_result_methods.rb | Ruby | mit | 19 | main | 1,410 | require_relative "identity_processor"
module PageEz
module MethodGenerators
class DefineHasManyResultMethods
def initialize(name, evaluator_class:, constructor:, processor: IdentityProcessor)
@name = name
@evaluator_class = evaluator_class
@constructor = constructor
@process... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/method_generators/has_many_ordered_selector.rb | Ruby | mit | 19 | main | 1,316 | module PageEz
module MethodGenerators
class HasManyOrderedSelector
attr_reader :selector
def initialize(name, selector, dynamic_options, options, &block)
@name = name
@selector = selector
@core_selector = HasManyStaticSelector.new(name, selector, dynamic_options, options, &blo... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/visitors/matcher_collision_visitor.rb | Ruby | mit | 19 | main | 2,003 | module PageEz
module Visitors
class MatcherCollisionVisitor
def initialize
reset
end
def begin_block_evaluation
@depth_visitor.begin_block_evaluation
end
def end_block_evaluation
@depth_visitor.end_block_evaluation
end
def define_method(name)
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/visitors/debug_visitor.rb | Ruby | mit | 19 | main | 1,494 | module PageEz
module Visitors
class DebugVisitor
def initialize
reset
end
def begin_block_evaluation
@depth_visitor.begin_block_evaluation
end
def end_block_evaluation
@depth_visitor.end_block_evaluation
end
def define_method(name)
@dept... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/visitors/macro_pluralization_visitor.rb | Ruby | mit | 19 | main | 1,938 | module PageEz
module Visitors
class MacroPluralizationVisitor
def initialize
reset
end
def begin_block_evaluation
@depth_visitor.begin_block_evaluation
end
def end_block_evaluation
@depth_visitor.end_block_evaluation
end
def define_method(name)
... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/visitors/depth_visitor.rb | Ruby | mit | 19 | main | 621 | module PageEz
module Visitors
class DepthVisitor
attr_reader :depth
def initialize
reset
end
def begin_block_evaluation
@depth += 1
end
def end_block_evaluation
@depth -= 1
end
def define_method(name)
end
def inherit_from(sub... |
github | joshuaclayton/page_ez | https://github.com/joshuaclayton/page_ez | lib/page_ez/visitors/registered_name_visitor.rb | Ruby | mit | 19 | main | 2,650 | module PageEz
module Visitors
class RegisteredNameVisitor
def initialize
reset
end
def begin_block_evaluation
@parents.push(@current_strategy)
end
def end_block_evaluation
@parents.pop
end
def define_method(*)
end
def inherit_from(*... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | Gemfile | Ruby | mit | 19 | develop | 282 | source 'https://rubygems.org'
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
# Specify your gem's dependencies in twitty.gemspec
gemspec
gem 'oauth'
gem 'rubocop', require: false
gem 'rubocop-performance', require: false
gem 'rubocop-rspec', require: false |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | twitty.gemspec | Ruby | mit | 19 | develop | 1,543 | lib = File.expand_path('lib', __dir__)
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
require 'twitty/version'
Gem::Specification.new do |spec|
spec.name = 'twitty'
spec.version = Twitty::VERSION
spec.authors = ['Subin T P', 'Pranav Raj S', 'Sojan Jose']
spec.email = ['hel... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | lib/twitty.rb | Ruby | mit | 19 | develop | 300 | require 'oauth'
require 'json'
require 'twitty/version'
require 'twitty/constants'
require 'twitty/config'
require 'twitty/payload'
require 'twitty/request'
require 'twitty/response'
require 'twitty/errors'
require 'twitty/facade'
class Twitty::Error < StandardError
# Your code goes here...
end |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | lib/twitty/response.rb | Ruby | mit | 19 | develop | 251 | # frozen_string_literal: true
class Twitty::Response
attr_reader :raw_response
def initialize(raw_response)
@raw_response = raw_response
end
def body
JSON.parse(raw_response.body)
end
def status
raw_response.code
end
end |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | lib/twitty/config.rb | Ruby | mit | 19 | develop | 475 | class Twitty::Config
attr_accessor :consumer_key,
:consumer_secret,
:access_token,
:access_token_secret,
:base_url,
:environment
def initialize(params = {})
@base_url = params[:base_url]
@consumer_key = params[:consumer_key]
... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | lib/twitty/payload.rb | Ruby | mit | 19 | develop | 1,308 | # frozen_string_literal: true
module Twitty::Payload
EMPTY_PAYLOAD_ACTIONS = %w[fetch_webhooks register_webhook unregister_webhook fetch_subscriptions
create_subscription remove_subscription destroy_tweet retweet unretweet user_show ].freeze
EMPTY_PAYLOAD_ACTIONS.each do |action|
... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | lib/twitty/request.rb | Ruby | mit | 19 | develop | 950 | class Twitty::Request
attr_reader :url, :type, :payload, :config
HEADERS = { 'Content-Type' => 'application/json; charset=utf-8' }
def self.execute(params)
new(params)
end
def initialize(params)
@url = params[:url]
@type = params[:type]
@payload = params[:payload]
@config = params[:conf... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | lib/twitty/constants.rb | Ruby | mit | 19 | develop | 2,448 | # frozen_string_literal: true
module Twitty::Constants
API_CONFIG = {
fetch_webhooks: {
method: :get,
endpoint: '/1.1/account_activity/all/%<env>s/webhooks.json',
required_params: []
},
register_webhook: {
method: :post,
endpoint: '/1.1/account_activity/all/%<env>s/webhooks... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | lib/twitty/facade.rb | Ruby | mit | 19 | develop | 1,596 | # frozen_string_literal: true
class Twitty::Facade
include Twitty::Constants
include Twitty::Payload
def initialize
yield(config) if block_given?
end
API_CONFIG.each do |action, _config|
define_method action do |data = {}|
define_actions(action, data)
end
end
def generate_crc(crc_tok... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | spec/spec_helper.rb | Ruby | mit | 19 | develop | 362 | require 'bundler/setup'
require 'twitty'
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_patching!
config.expect_with :rspe... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | spec/twitty/facade_spec.rb | Ruby | mit | 19 | develop | 658 | # frozen_string_literal: true
RSpec.describe Twitty::Facade do
before :all do
@facade = Twitty::Facade.new do |config|
config.consumer_key = 'TEST_CONSUMER_KEY'
config.consumer_secret = 'TEST_CONSUMER_SECRET'
config.access_token = 'TEST_ACCESS_TOKEN'
config.access_token_secret = 'TEST_ACC... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | spec/twitty/config_spec.rb | Ruby | mit | 19 | develop | 1,001 | # frozen_string_literal: true
RSpec.describe Twitty::Config do
describe 'Initialization' do
before :all do
@params = {
consumer_key: 'TEST_CONSUMER_KEY',
consumer_secret: 'TEST_CONSUMER_SECRET',
access_token: 'TEST_ACCESS_TOKEN',
access_token_secret: 'TEST_ACCESS_SECRET',
... |
github | chatwoot/twitty | https://github.com/chatwoot/twitty | spec/twitty/request_spec.rb | Ruby | mit | 19 | develop | 1,036 | RSpec.describe Twitty::Request do
before :all do
config_params = {
consumer_key: 'TEST_CONSUMER_KEY',
consumer_secret: 'TEST_CONSUMER_SECRET',
access_token: 'TEST_ACCESS_TOKEN',
access_token_secret: 'TEST_ACCESS_SECRET',
base_url: 'https://api.twitter.com/',
environment: 'chatw... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | config.ru | Ruby | mit | 19 | main | 816 | # ------------------------------------------------------------------------------
# ~/config.ru
#
# Transforms a J1 based site into a web application based on Rack and
# Sinatra using the OmniAuth software stack (for authentication) managed
# by Warden (for session managemnent) for a secured static web
#
# Product/Info:... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | Gemfile | Ruby | mit | 19 | main | 11,008 | # ------------------------------------------------------------------------------
# ~/Gemfile (runtime)
# Provides package information to bundle all Ruby gem needed
# for Jekyll and J1 Theme (managed by Ruby Gem Bundler)
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is ... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/index/lunr.rb | Ruby | mit | 19 | main | 12,401 | # ------------------------------------------------------------------------------
# ~/_plugins/lunr_index.rb
# Creates a index file (json) to be used by J1 Lunr
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.com/jek... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/encryptAES.rb | Ruby | mit | 19 | main | 1,629 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/encode64JSON.rb
# Liquid filter for J1 Theme to Base64 encode a JSON string
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/liquify.rb | Ruby | mit | 19 | main | 802 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/liquify.rb
# Liquid filter to expand nested liquid-variables in the front matter
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: ... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/minifyJSON.rb | Ruby | mit | 19 | main | 1,530 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/minifyJSON.rb
# Liquid filter for J1 Theme to minify a JSON string
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/minifyJS.rb | Ruby | mit | 19 | main | 1,982 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/uglify.rb
# Liquid filter for J1 Theme to uglify JS
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.com/jekyll-one... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/filters.rb | Ruby | mit | 19 | main | 15,140 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/filters.rb
# Liquid filtersfor J1 Theme
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.com/jekyll-one-org/j1-tem... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/prettify.rb | Ruby | mit | 19 | main | 1,191 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/prettify.rb
# Liquid filter for J1 Theme to beautify HTML code
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.com... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/xml_prettify.rb | Ruby | mit | 19 | main | 1,032 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/xml_prettify.rb
# Liquid filter for J1 Theme to beautify XML code
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/debug.rb | Ruby | mit | 19 | main | 1,572 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/debug.rb
# Helper to inspect liquid template variables for Jekyll
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/filter/encodeBase64.rb | Ruby | mit | 19 | main | 1,411 | # ------------------------------------------------------------------------------
# ~/_plugins/filter/encodeBase64.rb
# Liquid filter for J1 Theme to Base64 encode
#
# Product/Info:
# http://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://github.com/... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/asciidoctor/wistia-block.rb | Ruby | mit | 19 | main | 13,440 | # ------------------------------------------------------------------------------
# ~/_plugins/asciidoctor-extensions/wistia-block.rb
# Asciidoctor extension for Vimeo Video
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://... |
github | jekyll-one/j1-template-starter | https://github.com/jekyll-one/j1-template-starter | _plugins/asciidoctor/banner.rb | Ruby | mit | 19 | main | 1,175 | # ------------------------------------------------------------------------------
# ~/_plugins/asciidoctor-extensions/banner.rb
# Asciidoctor extension for J1 Banner blocks
#
# Product/Info:
# https://jekyll.one
#
# Copyright (C) 2023-2026 Juergen Adams
#
# J1 Template is licensed under the MIT License.
# See: https://g... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.