repo stringlengths 5 92 | file_url stringlengths 80 287 | file_path stringlengths 5 197 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 15:37:27 2026-01-04 17:58:21 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/invoice_payment.rb | lib/harvest/invoice_payment.rb | module Harvest
class InvoicePayment < Hashie::Mash
include Harvest::Model
api_path '/payments'
def self.json_root; 'payment'; end
end
end
| ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/contact.rb | lib/harvest/contact.rb | module Harvest
# The model that contains information about a client contact
#
# == Fields
# [+id+] (READONLY) the id of the contact
# [+client_id+] (REQUIRED) the id of the client this contact is associated with
# [+first_name+] (REQUIRED) the first name of the contact
# [+last_name+] (REQUIRED) the last ... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/model.rb | lib/harvest/model.rb | module Harvest
module Model
def self.included(base)
base.send :include, InstanceMethods
base.send :extend, ClassMethods
end
module InstanceMethods
def to_json(*args)
as_json(*args).to_json(*args)
end
def as_json(args = {})
inner_json = self.to_hash.stringify... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/hardy_client.rb | lib/harvest/hardy_client.rb | module Harvest
class HardyClient < Delegator
def initialize(client, max_retries)
super(client)
@_sd_obj = @client = client
@max_retries = max_retries
(@client.public_methods - Object.public_instance_methods).each do |name|
instance_eval <<-END
def #{name}(*args)
... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/user.rb | lib/harvest/user.rb | module Harvest
# The model that contains information about a task
#
# == Fields
# [+id+] (READONLY) the id of the user
# [+email+] the email of the user
# [+first_name+] the first name for the user
# [+last_name+] the last name for the user
# [+telephone+] the telephone for the user
# [+department] t... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/expenses.rb | lib/harvest/api/expenses.rb | module Harvest
module API
class Expenses < Base
api_model Harvest::Expense
include Harvest::Behavior::Crud
def all(date = ::Time.now, user = nil)
date = ::Time.parse(date) if String === date
response = request(:get, credentials, "#{api_model.api_path}/#{date.yday}/#{date.year}"... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/users.rb | lib/harvest/api/users.rb | module Harvest
module API
class Users < Base
api_model Harvest::User
include Harvest::Behavior::Crud
include Harvest::Behavior::Activatable
# Triggers Harvest to reset the user's password and sends them an email to change it.
# @overload reset_password(id)
# @para... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/account.rb | lib/harvest/api/account.rb | module Harvest
module API
# API Methods to contain all account actions
class Account < Base
# Returns the current rate limit information
# @return [Harvest::RateLimitStatus]
def rate_limit_status
response = request(:get, credentials, '/account/rate_limit_status')
... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/contacts.rb | lib/harvest/api/contacts.rb | module Harvest
module API
class Contacts < Base
api_model Harvest::Contact
include Harvest::Behavior::Crud
def all(client_id = nil)
response = if client_id
request(:get, credentials, "/clients/#{client_id}/contacts")
else
request(:get, credentials, "... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/time.rb | lib/harvest/api/time.rb | module Harvest
module API
class Time < Base
def find(id, user = nil)
response = request(:get, credentials, "/daily/show/#{id.to_i}", :query => of_user_query(user))
Harvest::TimeEntry.parse(response.parsed_response).first
end
def all(date = ::Time.now, user = nil)
... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/invoices.rb | lib/harvest/api/invoices.rb | module Harvest
module API
class Invoices < Base
api_model Harvest::Invoice
include Harvest::Behavior::Crud
# == Retrieves invoices
#
# == Available options
# - :status - invoices by status
# - :page
# - :updated_since
# - :timeframe (must be a nested hash wit... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/invoice_payments.rb | lib/harvest/api/invoice_payments.rb | module Harvest
module API
class InvoicePayments < Base
api_model Harvest::InvoicePayment
include Harvest::Behavior::Crud
def all(invoice)
response = request(:get, credentials, "/invoices/#{invoice.to_i}/payments")
api_model.parse(response.parsed_response)
end
def fi... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/reports.rb | lib/harvest/api/reports.rb | module Harvest
module API
class Reports < Base
TIME_FORMAT = '%Y%m%d'
def time_by_project(project, start_date, end_date, options = {})
query = { from: start_date.strftime(TIME_FORMAT), to: end_date.strftime(TIME_FORMAT) }
query[:user_id] = options.delete(:user).to_i if options[... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/invoice_messages.rb | lib/harvest/api/invoice_messages.rb | module Harvest
module API
class InvoiceMessages < Base
api_model Harvest::InvoiceMessage
include Harvest::Behavior::Crud
def all(invoice)
response = request(:get, credentials, "/invoices/#{invoice.to_i}/messages")
api_model.parse(response.parsed_response)
end
def fi... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/projects.rb | lib/harvest/api/projects.rb | module Harvest
module API
class Projects < Base
api_model Harvest::Project
include Harvest::Behavior::Crud
# Retrieves all projects. Note: this requires project manager or administrator authorization.
# @return [Harvest::Project]
def all(*)
super
rescue NotFound... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/base.rb | lib/harvest/api/base.rb | module Harvest
module API
class Base
attr_reader :credentials
def initialize(credentials)
@credentials = credentials
end
class << self
def api_model(klass)
class_eval <<-END
def api_model
#{klass}
end
END
e... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/clients.rb | lib/harvest/api/clients.rb | module Harvest
module API
class Clients < Base
api_model Harvest::Client
include Harvest::Behavior::Crud
include Harvest::Behavior::Activatable
end
end
end | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/user_assignments.rb | lib/harvest/api/user_assignments.rb | module Harvest
module API
class UserAssignments < Base
def all(project, query = {})
response = request(:get, credentials, "/projects/#{project.to_i}/user_assignments", {query: query})
Harvest::UserAssignment.parse(response.parsed_response)
end
def find(project, id)
... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/tasks.rb | lib/harvest/api/tasks.rb | module Harvest
module API
class Tasks < Base
api_model Harvest::Task
include Harvest::Behavior::Crud
# Deactivating tasks is not yet supported by the Harvest API.
# Deactivates the task. Does nothing if the task is already deactivated
#
# @param [Harvest::Task] task the tas... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/expense_categories.rb | lib/harvest/api/expense_categories.rb | module Harvest
module API
class ExpenseCategories < Base
api_model Harvest::ExpenseCategory
include Harvest::Behavior::Crud
end
end
end | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/invoice_categories.rb | lib/harvest/api/invoice_categories.rb | module Harvest
module API
class InvoiceCategories < Base
api_model Harvest::InvoiceCategory
include Harvest::Behavior::Crud
def find(*)
raise "find is unsupported for InvoiceCategories"
end
def create(model)
model = api_model.wrap(model)
response = request(:... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/api/task_assignments.rb | lib/harvest/api/task_assignments.rb | module Harvest
module API
class TaskAssignments < Base
def all(project, query = {})
response = request(:get, credentials, "/projects/#{project.to_i}/task_assignments", {query: query})
Harvest::TaskAssignment.parse(response.parsed_response)
end
def find(project, id)
... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/behavior/activatable.rb | lib/harvest/behavior/activatable.rb | module Harvest
module Behavior
# Activate/Deactivate behaviors that can be brought into API collections
module Activatable
# Deactivates the item. Does nothing if the item is already deactivated
#
# @param [Harvest::BaseModel] model the model you want to deactivate
# @return [Har... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/harvest/behavior/crud.rb | lib/harvest/behavior/crud.rb | module Harvest
module Behavior
module Crud
# Retrieves all items
# @return [Array<Harvest::BaseModel>] an array of models depending on where you're calling it from (e.g. [Harvest::Client] from Harvest::Base#clients)
def all(user = nil, query_options = {})
query = query_options.merge!(of_... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/ext/array.rb | lib/ext/array.rb | # Shamelessly ripped from https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/array/wrap.rb
unless Array.respond_to?(:wrap)
class Array
# Wraps its argument in an array unless it is already an array (or array-like).
#
# Specifically:
#
# * If the argument is +nil+... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/ext/time.rb | lib/ext/time.rb | unless Time.respond_to?(:to_time)
class Time
def to_time; self; end
end
end | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/ext/hash.rb | lib/ext/hash.rb | # Shamelessly ripped from https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/hash/keys.rb
unless Hash.respond_to?(:stringify_keys)
class Hash
# Return a new hash with all keys converted to strings.
def stringify_keys
dup.stringify_keys!
end
def stringify_k... | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
zmoazeni/harvested | https://github.com/zmoazeni/harvested/blob/33d26049651fde6adf651d5c8aff8fff97156210/lib/ext/date.rb | lib/ext/date.rb | # Shamelessly ripped from https://github.com/rails/rails/blob/master/activesupport/lib/active_support/core_ext/date/conversions.rb
unless ::Date.respond_to?(:to_time)
class ::Date
def to_time(*)
::Time.utc(year, month, day)
end
end
end | ruby | MIT | 33d26049651fde6adf651d5c8aff8fff97156210 | 2026-01-04T17:50:27.559404Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/ebnf.rb | ebnf.rb | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false | |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/rule_spec.rb | spec/rule_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF::Rule do
let(:debug) {[]}
let(:ebnf) {EBNF.parse(File.open(File.expand_path("../../etc/ebnf.ebnf", __FILE__)), format: :native)}
subject {EBNF::Rule.new(:rule, "0", [:seq, :foo])}
describe ".from_sxp" do
contex... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/writer_spec.rb | spec/writer_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
require 'nokogiri'
describe EBNF::Writer do
RSpec::Matchers.define :have_xpath do |path, value|
match do |actual|
doc = Nokogiri::HTML.parse(actual)
return false unless doc
@result = doc.at_xpath(path.to_s) rescue... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/matchers.rb | spec/matchers.rb | # coding: utf-8
def normalize(obj)
if obj.is_a?(String)
obj.gsub(/\s+/m, ' ').
gsub(/\s+\)/m, ')').
gsub(/\(\s+/m, '(').
strip
else
obj
end
end
Info = Struct.new(:id, :logger, :action, :result, :format)
RSpec::Matchers.define :produce do |expected, info|
match do |actual|
@info =... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/bnf_spec.rb | spec/bnf_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF::BNF do
describe "#make_bnf" do
{
%{[2] Prolog ::= BaseDecl? PrefixDecl*} =>
%{((rule _empty "0" (seq))
(rule Prolog "2" (seq _Prolog_1 _Prolog_2))
(rule _Prolog_1 "2.1" ... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/abnf_spec.rb | spec/abnf_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF::ABNF do
let(:logger) {RDF::Spec.logger}
after(:each) do |example|
puts logger.to_s if example.exception && !example.exception.is_a?(RSpec::Expectations::ExpectationNotMetError)
end
context "rule variations" do... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/ll1_spec.rb | spec/ll1_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF::Base do
let(:logger) {RDF::Spec.logger}
after(:each) do |example|
puts logger.to_s if example.exception && !example.exception.is_a?(RSpec::Expectations::ExpectationNotMetError)
end
describe "#first_follow" do
... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/isoebnf_spec.rb | spec/isoebnf_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF::ISOEBNF do
let(:logger) {RDF::Spec.logger}
after(:each) do |example|
puts logger.to_s if example.exception && !example.exception.is_a?(RSpec::Expectations::ExpectationNotMetError)
end
context "rule variations"... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/native_spec.rb | spec/native_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF::Native do
let(:logger) {RDF::Spec.logger}
after(:each) do |example|
puts logger.to_s if example.exception && !example.exception.is_a?(RSpec::Expectations::ExpectationNotMetError)
end
context "rule variations" ... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/peg_spec.rb | spec/peg_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF::PEG do
describe "#make_peg" do
{
%{[2] Prolog ::= BaseDecl? PrefixDecl*} =>
%{((rule Prolog "2" (seq _Prolog_1 _Prolog_2))
(rule _Prolog_1 "2.1" (opt BaseDecl))
(rule _P... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/unescape_spec.rb | spec/unescape_spec.rb | # coding: utf-8
$:.unshift ".."
require 'spec_helper'
require 'ebnf'
describe EBNF::Unescape do
describe ".unescape_codepoints" do
# @see https://www.w3.org/TR/rdf-sparql-query/#codepointEscape
it "unescapes \\uXXXX codepoint escape sequences" do
inputs = {
%q(\\u0020) => %q( ),
... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/base_spec.rb | spec/base_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
require 'rdf/turtle'
describe EBNF::Base do
subject {PARSED_EBNF_GRAMMAR.dup}
describe "#initialize" do
{
%{[2] Prolog ::= BaseDecl? PrefixDecl*} =>
%{((rule Prolog "2" (seq (opt BaseDecl) (star Pr... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/parser_spec.rb | spec/parser_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF::Parser do
let(:logger) {RDF::Spec.logger}
after(:each) do |example|
puts logger.to_s if example.exception && !example.exception.is_a?(RSpec::Expectations::ExpectationNotMetError)
end
context "rule variations" ... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/ebnf_spec.rb | spec/ebnf_spec.rb | # coding: utf-8
$:.unshift "."
require 'spec_helper'
require 'ebnf'
require 'sxp'
describe EBNF do
describe ".parse" do
{
%{[2] Prolog ::= BaseDecl? PrefixDecl*} =>
%{((rule Prolog "2" (seq (opt BaseDecl) (star PrefixDecl))))},
%{
@terminals
[3] terminal ::= [... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/spec_helper.rb | spec/spec_helper.rb | $:.unshift(File.expand_path("../../lib", __FILE__))
$:.unshift File.dirname(__FILE__)
require 'bundler/setup'
require 'amazing_print'
require 'rdf/spec'
require 'rdf/spec/matchers'
require 'rspec'
require 'rspec/matchers'
require 'rspec/its'
require 'matchers'
begin
require 'simplecov'
require 'simplecov-lcov'
... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/peg/rule_spec.rb | spec/peg/rule_spec.rb | # coding: utf-8
$:.unshift ".."
require 'spec_helper'
require 'ebnf'
describe EBNF::PEG::Rule do
describe "#parse" do
let(:parser_class) {double("PEG Parser Class", terminal_regexps: {})}
let(:parser) {
double("PEG Parser", whitespace: /\s+/, packrat: {}, update_furthest_failure: true, class: parser_cl... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/peg/parser_spec.rb | spec/peg/parser_spec.rb | # coding: utf-8
$:.unshift ".."
require 'spec_helper'
require 'ebnf'
describe EBNF::PEG::Parser do
class PegParserTest
include EBNF::PEG::Parser
end
before(:all) {
PegParserTest.start_production(:term) {"foo"}
PegParserTest.production(:term) {"foo"}
PegParserTest.start_production(:toLower, insen... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/peg/data/parser.rb | spec/peg/data/parser.rb | # # EBNF Parser for EBNF.
#
# Produces an Abstract Synatx Tree in S-Expression form for the input grammar file
require 'ebnf/rule'
require 'ebnf/terminals'
require 'ebnf/peg/parser'
require 'sxp'
class EBNFPegParser
include EBNF::PEG::Parser
include EBNF::Terminals
# Abstract syntax tree from parse
#
# @ret... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/ll1/scanner_spec.rb | spec/ll1/scanner_spec.rb | # coding: utf-8
$:.unshift ".."
require 'spec_helper'
require 'ebnf'
describe EBNF::LL1::Scanner do
describe ".new" do
it "initializes with a StringIO" do
scanner = EBNF::LL1::Scanner.new(StringIO.new("line1\nline2\n"))
expect(scanner.rest).to eq "line1\nline2\n"
expect(scanner).not_to be_eos
... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/ll1/parser_spec.rb | spec/ll1/parser_spec.rb | # coding: utf-8
$:.unshift ".."
require 'spec_helper'
require 'ebnf'
describe EBNF::LL1::Parser do
class LL1ParserTest
include EBNF::LL1::Parser
end
before(:all) {
LL1ParserTest.start_production(:term) {"foo"}
LL1ParserTest.production(:term) {"foo"}
LL1ParserTest.terminal(:escape, /escape/) {"fo... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/ll1/lexer_spec.rb | spec/ll1/lexer_spec.rb | # coding: utf-8
$:.unshift ".."
require 'spec_helper'
require 'ebnf'
describe EBNF::LL1::Lexer do
let!(:terminals) {[
[:ANON, ANON],
[nil, %r([\(\),.;\[\]a]|\^\^|@base|@prefix|true|false)],
[:BLANK_NODE_LABEL, BLANK_NODE_LABEL],
... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/ll1/data/meta.rb | spec/ll1/data/meta.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from etc/ebnf.ebnf
module EBNFParserMeta
START = :ebnf
BRANCH = {
:alt => {
"(" => [:seq, :_alt_1],
:HEX => [:seq, :_alt_1],
:O_RANGE => [:seq, :_alt_1],
:RANGE => [:seq, :_alt_1],
:STRING1 => [:seq, :_alt_1],
... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/spec/ll1/data/parser.rb | spec/ll1/data/parser.rb | # # EBNF Parser for EBNF.
#
# Produces an Abstract Synatx Tree in S-Expression form for the input grammar file
require 'ebnf/rule'
require 'ebnf/terminals'
require 'ebnf/ll1/parser'
require_relative 'meta'
require 'sxp'
class EBNFParser
include EBNF::LL1::Parser
include EBNFParserMeta
include EBNF::Terminals
... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/ebnf-ll1-parser/meta.rb | examples/ebnf-ll1-parser/meta.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from ../../etc/ebnf.ebnf
module EBNFParserMeta
START = :ebnf
BRANCH = {
:alt => {
"(" => [:seq, :_alt_1],
:HEX => [:seq, :_alt_1],
:O_RANGE => [:seq, :_alt_1],
:RANGE => [:seq, :_alt_1],
:STRING1 => [:seq, :_alt... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/ebnf-ll1-parser/parser.rb | examples/ebnf-ll1-parser/parser.rb | # # EBNF Parser for EBNF.
#
# Produces an Abstract Synatx Tree in S-Expression form for the input grammar file
require 'ebnf/rule'
require 'ebnf/terminals'
require 'ebnf/ll1/parser'
require 'meta'
require 'sxp'
require 'logger'
class EBNFLL1Parser
include EBNF::LL1::Parser
include EBNFParserMeta
include EBNF::Te... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/isoebnf/meta.rb | examples/isoebnf/meta.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from ../../etc/iso-ebnf.ebnf
module ISOEBNFMeta
RULES = [
EBNF::Rule.new(:syntax, nil, [:star, :syntax_rule]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:syntax_rule, nil, [:seq, :meta_identifier, :defining_symbol, :definitions_list, :termina... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/isoebnf/parser.rb | examples/isoebnf/parser.rb | # # EBNF Parser for EISO BNF.
#
# Produces an Abstract Synatx Tree in S-Expression form for the input grammar file
require 'ebnf'
require 'ebnf/terminals'
require 'ebnf/peg/parser'
require 'meta'
require 'sxp'
require 'logger'
class ISOEBNFPegParser
include EBNF::PEG::Parser
# The base for terminal-character, whi... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/abnf/core.rb | examples/abnf/core.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from ../../etc/abnf-core.ebnf
module ABNFCore
RULES = [
EBNF::Rule.new(:ALPHA, nil, [:range, "#x41-#x5A#x61-#x7A"], kind: :terminal),
EBNF::Rule.new(:BIT, nil, [:alt, "0", "1"], kind: :terminal),
EBNF::Rule.new(:CHAR, nil, [:range, "#x... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/abnf/meta.rb | examples/abnf/meta.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from ../../etc/abnf.ebnf
module ABNFMeta
RULES = [
EBNF::Rule.new(:rulelist, nil, [:plus, :_rulelist_1]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:_rulelist_1, nil, [:alt, :rule, :_rulelist_2]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:_... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/abnf/parser.rb | examples/abnf/parser.rb | # # EBNF Parser for ABNF.
#
# Produces an Abstract Synatx Tree in S-Expression form for the input grammar file
require 'ebnf'
require 'ebnf/terminals'
require 'ebnf/peg/parser'
require 'core' # "Core" rules used in the ABNF spec.
require 'meta' # "ABNF" rules used for parsing ABNF, itself
require 'scanf'
require ... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/calc/calc.rb | examples/calc/calc.rb | # # EBNF Parser for EBNF.
#
# Produces an Abstract Synatx Tree in S-Expression form for the input grammar file
require 'ebnf'
require 'ebnf/terminals'
require 'ebnf/peg/parser'
require 'sxp'
require 'logger'
class Calc
include EBNF::PEG::Parser
# Abstract syntax tree from parse
#
# @return [Array<EBNF::Rule>]... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/ebnf-peg-parser/meta.rb | examples/ebnf-peg-parser/meta.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from ../../etc/ebnf.ebnf
module EBNFPegMeta
RULES = [
EBNF::Rule.new(:ebnf, "1", [:star, :_ebnf_1]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:_ebnf_1, "1.1", [:alt, :declaration, :rule]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:declarat... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/examples/ebnf-peg-parser/parser.rb | examples/ebnf-peg-parser/parser.rb | # # EBNF Parser for EBNF.
#
# Produces an Abstract Synatx Tree in S-Expression form for the input grammar file
require 'ebnf'
require 'ebnf/terminals'
require 'ebnf/peg/parser'
require 'meta'
require 'sxp'
require 'logger'
class EBNFPegParser
include EBNF::PEG::Parser
include EBNF::Terminals
# Abstract syntax t... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf.rb | lib/ebnf.rb | require 'sxp' unless defined?(SXP)
module EBNF
autoload :ABNF, "ebnf/abnf"
autoload :Base, "ebnf/base"
autoload :BNF, "ebnf/bnf"
autoload :ISOEBNF, "ebnf/isoebnf"
autoload :LL1, "ebnf/ll1"
autoload :Native, "ebnf/native"
autoload :Parser, "ebnf/parser"
autoload :PEG, "ebnf/p... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/version.rb | lib/ebnf/version.rb | module EBNF
module VERSION
VERSION_FILE = File.join(File.expand_path(File.dirname(__FILE__)), "..", "..", "VERSION")
MAJOR, MINOR, TINY, EXTRA = File.read(VERSION_FILE).chomp.split(".")
STRING = [MAJOR, MINOR, TINY, EXTRA].compact.join('.')
##
# @return [String]
def self.to_s() STRING end
... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/peg.rb | lib/ebnf/peg.rb | module EBNF
module PEG
autoload :Parser, 'ebnf/peg/parser'
autoload :Rule, 'ebnf/peg/rule'
##
# Transform EBNF Rule set for PEG parsing:
#
# * Transform each rule into a set of sub-rules extracting unnamed sequences into new rules, using {Rule#to_peg}.
# @return [ENBF] self
def make... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/abnf.rb | lib/ebnf/abnf.rb | require_relative 'abnf/core'
require_relative 'abnf/meta'
require 'logger'
# ABNF parser
# Parses ABNF into an array of {EBNF::Rule}.
module EBNF
class ABNF
include EBNF::PEG::Parser
# Regular expressions for both "Core" and ABNF-specific terminals.
ALPHA = %r{[\x41-\x5A\x61-\x7A]}
VCHAR = %r{[\x20-... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/parser.rb | lib/ebnf/parser.rb | require_relative 'ebnf/meta'
require 'logger'
module EBNF
class Parser
include EBNF::PEG::Parser
include EBNF::Terminals
# Abstract syntax tree from parse
#
# @return [Array<EBNF::Rule>]
attr_reader :ast
# Set on first rule
attr_reader :lhs_includes_identifier
# Regular express... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/base.rb | lib/ebnf/base.rb | require 'strscan'
require 'sxp' unless defined?(SXP)
# Extended Bakus-Nour Form (EBNF), being the W3C variation is
# originaly defined in the
# [W3C XML 1.0 Spec](https://www.w3.org/TR/REC-xml/#sec-notation).
#
# This version attempts to be less strict than the strict definition
# to allow for coloquial variations (su... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/writer.rb | lib/ebnf/writer.rb | # -*- encoding: utf-8 -*-
require 'rdf'
require 'strscan' unless defined?(StringScanner)
require "ostruct"
require 'unicode/types'
##
# Serialize ruleset back to EBNF
module EBNF
class Writer
LINE_LENGTH = 80
LINE_LENGTH_HTML = 200
# UNICODE escape names
# From https://en.wikipedia.org/wiki/List_... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/native.rb | lib/ebnf/native.rb | module EBNF
module Native
##
# Native parser for EBNF; less accurate, but appropriate when changing EBNF grammar, itself.
#
# Iterate over rule strings.
# a line that starts with '\[' or '@' starts a new rule
#
# @param [StringScanner] scanner
# @yield rule_string
# @yieldparam [St... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/isoebnf.rb | lib/ebnf/isoebnf.rb | require_relative 'isoebnf/meta'
require 'logger'
# ISO EBNF parser
# Parses ISO EBNF into an array of {EBNF::Rule}.
module EBNF
class ISOEBNF
include EBNF::PEG::Parser
# The base for terminal-character, which omits "'", '"', and '?'.
# Could be more optimized, and one might quible
# with the overly-... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/rule.rb | lib/ebnf/rule.rb | require 'scanf'
require 'strscan'
require 'sxp' unless defined?(SXP)
module EBNF
# Represent individual parsed rules
class Rule
# Operations which are flattened to seprate rules in to_bnf.
BNF_OPS = %w{
alt diff not opt plus rept seq star
}.map(&:to_sym).freeze
TERM_OPS = %w{
hex istr ... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/ll1.rb | lib/ebnf/ll1.rb | module EBNF
##
# This module extends {EBNF::Base} to create metadata including _branch_, [First/Follow][], and other tables which is used by {EBNF::LL1::Parser} to recognize examples of the associated grammar.
#
### Branch Table
#
# The Branch table is a hash mapping production rules to a hash relating te... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/unescape.rb | lib/ebnf/unescape.rb | # encoding: utf-8
# Unsecape strings
module EBNF::Unescape
ESCAPE_CHARS = {
'\\t' => "\t", # \u0009 (tab)
'\\n' => "\n", # \u000A (line feed)
'\\r' => "\r", # \u000D (carriage return)
'\\b' => "\b", # \u0008 (backspace)
'\\f' => "\f", # \u000C (form feed)
'\\"' => '"', ... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/bnf.rb | lib/ebnf/bnf.rb | module EBNF
module BNF
##
# Transform EBNF Rule set to BNF:
#
# * Add rule [0] (_empty rule (seq))
# * Transform each rule into a set of rules that are just BNF, using {Rule#to_bnf}.
# @return [ENBF] self
def make_bnf
progress("make_bnf") {"Start: #{@ast.length} rules"}
new... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/terminals.rb | lib/ebnf/terminals.rb | # encoding: utf-8
# Terminal definitions for the EBNF grammar
module EBNF::Terminals
SYMBOL_BASE = %r(\b[a-zA-Z0-9_\.]+\b)u.freeze # Word boundaries
SYMBOL = %r((?:#{SYMBOL_BASE}|(?:<#{SYMBOL_BASE}>))(?!\s*::=))u.freeze
HEX = %r(\#x\h+)u.freeze
CHAR = %r([\u0009\u000A\u000D\u0020-\uD7FF\u{10000}-\u{10F... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/isoebnf/meta.rb | lib/ebnf/isoebnf/meta.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from etc/iso-ebnf.ebnf
module ISOEBNFMeta
RULES = [
EBNF::Rule.new(:syntax, nil, [:star, :syntax_rule]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:syntax_rule, nil, [:seq, :meta_identifier, :defining_symbol, :definitions_list, :terminator_sy... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/abnf/core.rb | lib/ebnf/abnf/core.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from etc/abnf-core.ebnf
module ABNFCore
RULES = [
EBNF::Rule.new(:ALPHA, nil, [:range, "#x41-#x5A#x61-#x7A"], kind: :terminal),
EBNF::Rule.new(:BIT, nil, [:alt, "0", "1"], kind: :terminal),
EBNF::Rule.new(:CHAR, nil, [:range, "#x01-#x7... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/abnf/meta.rb | lib/ebnf/abnf/meta.rb | # This file is automatically generated by ebnf version 2.0.0
# Derived from abnf.ebnf
module ABNFMeta
RULES = [
EBNF::Rule.new(:rulelist, nil, [:plus, :_rulelist_1]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:_rulelist_1, nil, [:alt, :rule, :_rulelist_2]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:_rulelist_2... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/peg/parser.rb | lib/ebnf/peg/parser.rb | module EBNF::PEG
##
# A Generic PEG parser using the parsed rules modified for PEG parseing.
module Parser
##
# @return [Regexp, Rule] how to remove inter-rule whitespace
attr_reader :whitespace
##
# @return [Scanner] used for scanning input.
attr_reader :scanner
##
# A Hash stru... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/peg/rule.rb | lib/ebnf/peg/rule.rb | module EBNF::PEG
# Behaviior for parsing a PEG rule
module Rule
include ::EBNF::Unescape
##
# Initialized by parser when loading rules.
# Used for finding rules and invoking elements of the parse process.
#
# @return [EBNF::PEG::Parser] parser
attr_accessor :parser
##
# Parse a... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/ll1/parser.rb | lib/ebnf/ll1/parser.rb | require 'ebnf/ll1/lexer'
module EBNF::LL1
##
# A Generic LL1 parser using a lexer and branch tables defined using the SWAP tool chain (modified).
#
# # Creating terminal definitions and parser rules to parse generated grammars
#
# The parser is initialized to callbacks invoked on entry and exit
# to e... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/ll1/lexer.rb | lib/ebnf/ll1/lexer.rb | module EBNF::LL1
require 'ebnf/ll1/scanner' unless defined?(Scanner)
##
# A lexical analyzer
#
# @example Tokenizing a Turtle string
# terminals = [
# [:BLANK_NODE_LABEL, %r(_:(#{PN_LOCAL}))],
# ...
# ]
# ttl = "@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> ."
# le... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/ll1/scanner.rb | lib/ebnf/ll1/scanner.rb | # coding: utf-8
require 'strscan' unless defined?(StringScanner)
module EBNF::LL1
##
# Overload StringScanner with file operations and line counting
#
# * Reloads scanner as required until EOF.
# * Loads to a high-water and reloads when remaining size reaches a low-water.
#
# FIXME: Only implements th... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/lib/ebnf/ebnf/meta.rb | lib/ebnf/ebnf/meta.rb | # This file is automatically generated by ebnf version 2.5.0
# Derived from etc/ebnf.ebnf
module EBNFMeta
RULES = [
EBNF::Rule.new(:ebnf, "1", [:star, :_ebnf_1]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:_ebnf_1, "1.1", [:alt, :declaration, :rule]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:declaration, "2",... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/etc/ebnf.peg.rb | etc/ebnf.peg.rb | # This file is automatically generated by ebnf version 2.5.0
# Derived from etc/ebnf.ebnf
module EBNFMeta
RULES = [
EBNF::Rule.new(:ebnf, "1", [:star, :_ebnf_1]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:_ebnf_1, "1.1", [:alt, :declaration, :rule]).extend(EBNF::PEG::Rule),
EBNF::Rule.new(:declaration, "2",... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
dryruby/ebnf | https://github.com/dryruby/ebnf/blob/2d26292c12187028cb7a9ac1bdd7a03942d53753/etc/ebnf.ll1.rb | etc/ebnf.ll1.rb | # This file is automatically generated by ebnf version 2.5.0
# Derived from etc/ebnf.ebnf
module Meta
START = :ebnf
BRANCH = {
:alt => {
"(" => [:seq, :_alt_1],
:HEX => [:seq, :_alt_1],
:O_RANGE => [:seq, :_alt_1],
:RANGE => [:seq, :_alt_1],
:STRING1 => [:seq, :_alt_1],
:STRI... | ruby | Unlicense | 2d26292c12187028cb7a9ac1bdd7a03942d53753 | 2026-01-04T17:50:30.524968Z | false |
tknerr/bills-kitchen | https://github.com/tknerr/bills-kitchen/blob/561d96d2aa4879b983a33554c3387d3e42436be9/files/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/docker/provider.rb | files/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/docker/provider.rb | require "digest/md5"
require "fileutils"
require "thread"
require "log4r"
require "vagrant/util/silence_warnings"
module VagrantPlugins
module DockerProvider
class Provider < Vagrant.plugin("2", :provider)
@@host_vm_mutex = Mutex.new
def initialize(machine)
@logger = Log4r::Logger.new("va... | ruby | MIT | 561d96d2aa4879b983a33554c3387d3e42436be9 | 2026-01-04T17:50:23.228346Z | false |
tknerr/bills-kitchen | https://github.com/tknerr/bills-kitchen/blob/561d96d2aa4879b983a33554c3387d3e42436be9/files/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/docker/synced_folder.rb | files/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/docker/synced_folder.rb | module VagrantPlugins
module DockerProvider
class SyncedFolder < Vagrant.plugin("2", :synced_folder)
def usable?(machine, raise_error=false)
# These synced folders only work if the provider is Docker
if machine.provider_name != :docker
if raise_error
raise Errors::Synce... | ruby | MIT | 561d96d2aa4879b983a33554c3387d3e42436be9 | 2026-01-04T17:50:23.228346Z | false |
tknerr/bills-kitchen | https://github.com/tknerr/bills-kitchen/blob/561d96d2aa4879b983a33554c3387d3e42436be9/files/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/docker/action/create.rb | files/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/docker/action/create.rb | module VagrantPlugins
module DockerProvider
module Action
class Create
def initialize(app, env)
@app = app
end
def call(env)
@env = env
@machine = env[:machine]
@provider_config = @machine.provider_config
@machine... | ruby | MIT | 561d96d2aa4879b983a33554c3387d3e42436be9 | 2026-01-04T17:50:23.228346Z | false |
tknerr/bills-kitchen | https://github.com/tknerr/bills-kitchen/blob/561d96d2aa4879b983a33554c3387d3e42436be9/files/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/docker/action/host_machine_port_checker.rb | files/tools/vagrant/HashiCorp/Vagrant/embedded/gems/gems/vagrant-1.7.4/plugins/providers/docker/action/host_machine_port_checker.rb | require "log4r"
module VagrantPlugins
module DockerProvider
module Action
# This sets up the middleware env var to check for ports in use.
class HostMachinePortChecker
def initialize(app, env)
@app = app
@logger = Log4r::Logger.new("vagrant::docker::hostmachineportcheck... | ruby | MIT | 561d96d2aa4879b983a33554c3387d3e42436be9 | 2026-01-04T17:50:23.228346Z | false |
tknerr/bills-kitchen | https://github.com/tknerr/bills-kitchen/blob/561d96d2aa4879b983a33554c3387d3e42436be9/spec/helpers.rb | spec/helpers.rb |
BUILD_DIR=File.expand_path('./target/build')
CHEFDK_RUBY = "#{BUILD_DIR}/tools/chefdk/embedded"
CHEFDK_HOME = "#{BUILD_DIR}/home/.chefdk"
VAGRANT_RUBY = "#{BUILD_DIR}/tools/vagrant/HashiCorp/Vagrant/embedded"
VAGRANT_HOME = "#{BUILD_DIR}/home/.vagrant.d"
# enable :should syntax for rspec 3
RSpec.configure do |config|... | ruby | MIT | 561d96d2aa4879b983a33554c3387d3e42436be9 | 2026-01-04T17:50:23.228346Z | false |
tknerr/bills-kitchen | https://github.com/tknerr/bills-kitchen/blob/561d96d2aa4879b983a33554c3387d3e42436be9/spec/integration/bills_kitchen_spec.rb | spec/integration/bills_kitchen_spec.rb |
require_relative '../helpers'
describe "bills kitchen" do
include Helpers
describe "tools" do
it "installs ChefDK 0.13.21" do
run_cmd("chef -v").should match('Chef Development Kit Version: 0.13.21')
end
it "installs Vagrant 1.8.1" do
run_cmd("vagrant -v").should match('1.8.1')
end
... | ruby | MIT | 561d96d2aa4879b983a33554c3387d3e42436be9 | 2026-01-04T17:50:23.228346Z | false |
tknerr/bills-kitchen | https://github.com/tknerr/bills-kitchen/blob/561d96d2aa4879b983a33554c3387d3e42436be9/doc/markit.rb | doc/markit.rb | #!/usr/bin/env ruby
# based on https://gist.github.com/1919161
require 'rubygems'
require 'redcarpet'
require 'albino'
class SyntaxRenderer < Redcarpet::Render::HTML
def initialize(options)
super options
@style = options[:style]
@otoc = options[:toc]
@toc = ""
@rlevel = nil
end
def doc_... | ruby | MIT | 561d96d2aa4879b983a33554c3387d3e42436be9 | 2026-01-04T17:50:23.228346Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/spec/spec_helper.rb | spec/spec_helper.rb | require 'tapp'
require 'tapp/turnip'
RSpec.configure do |config|
config.include Tapp::Turnip::Steps
config.expect_with :rspec do |expects|
expects.syntax = :should
end
config.before do
Tapp.config.reset
end
end
| ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp.rb | lib/tapp.rb | require 'tapp/configuration'
require 'tapp/deprecated'
require 'tapp/object_extension'
require 'tapp/printer/pretty_print'
require 'tapp/printer/puts'
module Tapp
extend Deprecated
class << self
def config
@config ||= Tapp::Configuration.new
end
def configure(&block)
config.tap(&block)
... | ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/deprecated.rb | lib/tapp/deprecated.rb | module Tapp
module Deprecated
def verbose=(bool)
warn 'DEPRECATION WARNING: Tapp.verbose= is deprecated. Use Tapp.config.report_caller= instead.'
config.report_caller = bool
end
def verbose
warn 'DEPRECATION WARNING: Tapp.verbose is deprecated. Use Tapp.config.report_caller instead.'
... | ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/turnip.rb | lib/tapp/turnip.rb | module Tapp
module Turnip
module Steps
step 'I have the following code:' do |code|
@code = code
end
step 'a file named :filename with:' do |filename, code|
@filename, @code = filename, code
end
step 'Ruby it' do
stdout = StringIO.new
$stdout = stdout... | ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/command.rb | lib/tapp/command.rb | require 'thor'
module Tapp
class Command < Thor
desc 'grep [<git-grep-options>]', 'Print lines using tapp'
def grep(*)
opts = ['--word-regexp', '-e', 'tapp', '-e', 'taputs', '-e', 'taap', *ARGV.drop(1)]
git_grep = ['git', 'grep', opts].flatten.join(' ')
puts `#{git_grep}`.gsub(/^Gemfile(\.l... | ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/version.rb | lib/tapp/version.rb | module Tapp
VERSION = '1.5.1'
end
| ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
esminc/tapp | https://github.com/esminc/tapp/blob/ddc458011a82db33617bed44c6a64838f8581e13/lib/tapp/object_extension.rb | lib/tapp/object_extension.rb | require 'tapp/printer'
require 'tapp/util'
module Tapp
module ObjectExtension
def tapp(printer = Tapp.config.default_printer)
Tapp::Util.report_called if Tapp.config.report_caller
tap {
Tapp::Printer.instance(printer).print block_given? ? yield(self) : self
}
end
def taputs(&b... | ruby | MIT | ddc458011a82db33617bed44c6a64838f8581e13 | 2026-01-04T17:50:46.572797Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.