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
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/type.rb
lib/typed_params/types/type.rb
# frozen_string_literal: true module TypedParams module Types class Type attr_reader :type, :name def initialize(type:, name:, match:, coerce:, scalar:, abstract:, archetype:, accepts_block:) raise ArgumentError, ':abstract not allowed with :archetype' if abstract...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/decimal.rb
lib/typed_params/types/decimal.rb
# frozen_string_literal: true module TypedParams module Types register(:decimal, coerce: -> v { v.blank? ? nil : v.to_d }, match: -> v { v.is_a?(BigDecimal) }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/array.rb
lib/typed_params/types/array.rb
# frozen_string_literal: true module TypedParams module Types register(:array, accepts_block: true, scalar: false, coerce: -> v { v.is_a?(String) ? v.split(',') : Array(v) }, match: -> v { v.is_a?(Array) }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/time.rb
lib/typed_params/types/time.rb
# frozen_string_literal: true module TypedParams module Types register(:time, match: -> v { v.is_a?(Time) }, coerce: -> v { return nil if v.blank? case when v.to_s.match?(/\A\d+\z/) Time.at(v.to_i) else v.to_time end }, ...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/float.rb
lib/typed_params/types/float.rb
# frozen_string_literal: true module TypedParams module Types register(:float, coerce: -> v { v.blank? ? nil : v.to_f }, match: -> v { v.is_a?(Float) }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/any.rb
lib/typed_params/types/any.rb
# frozen_string_literal: true module TypedParams module Types register(:any, abstract: true, match: -> _ {}, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/boolean.rb
lib/typed_params/types/boolean.rb
# frozen_string_literal: true module TypedParams module Types module Boolean COERCIBLE_TYPES = [String, Numeric].freeze TRUTHY_VALUES = [ 1, '1', 'true', 'TRUE', 't', 'T', 'yes', 'YES', 'y', 'Y', ].freeze end ...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/number.rb
lib/typed_params/types/number.rb
# frozen_string_literal: true module TypedParams module Types register(:number, match: -> v { v.is_a?(Numeric) }, abstract: true, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/string.rb
lib/typed_params/types/string.rb
# frozen_string_literal: true module TypedParams module Types register(:string, coerce: -> v { v.to_s }, match: -> v { v.is_a?(String) }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/integer.rb
lib/typed_params/types/integer.rb
# frozen_string_literal: true module TypedParams module Types register(:integer, coerce: -> v { v.blank? ? nil : v.to_i }, match: -> v { v.is_a?(Integer) }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/nil.rb
lib/typed_params/types/nil.rb
# frozen_string_literal: true module TypedParams module Types register(:nil, name: :null, coerce: -> v { nil }, match: -> v { v.nil? }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/hash.rb
lib/typed_params/types/hash.rb
# frozen_string_literal: true module TypedParams module Types register(:hash, name: :object, accepts_block: true, scalar: false, coerce: -> v { v.respond_to?(:to_h) ? v.to_h : {} }, match: -> v { v.is_a?(Hash) }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/date.rb
lib/typed_params/types/date.rb
# frozen_string_literal: true module TypedParams module Types register(:date, coerce: -> v { v.blank? ? nil : v.to_date }, match: -> v { v.is_a?(Date) }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/types/symbol.rb
lib/typed_params/types/symbol.rb
# frozen_string_literal: true module TypedParams module Types register(:symbol, coerce: -> v { v.to_sym }, match: -> v { v.is_a?(Symbol) }, ) end end
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/validations/format.rb
lib/typed_params/validations/format.rb
# frozen_string_literal: true require 'typed_params/validations/validation' module TypedParams module Validations class Format < Validation def call(value) raise ValidationError, 'format is invalid' unless case options in without: Regexp => rx !rx.match?(value) ...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/validations/length.rb
lib/typed_params/validations/length.rb
# frozen_string_literal: true require 'typed_params/validations/validation' module TypedParams module Validations class Length < Validation def call(value) case options in minimum: Numeric => min, maximum: Numeric => max raise ValidationError, "length must be between #{min} and #...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/validations/exclusion.rb
lib/typed_params/validations/exclusion.rb
# frozen_string_literal: true require 'typed_params/validations/validation' module TypedParams module Validations class Exclusion < Validation def call(value) raise ValidationError, 'is invalid' if case options in in: Range | Array => e e.include?(value) e...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/validations/depth.rb
lib/typed_params/validations/depth.rb
# frozen_string_literal: true require 'typed_params/validations/validation' require 'typed_params/path' module TypedParams module Validations class Depth < Validation def call(value) case options in maximum: Integer => maximum_depth return if maximum_depth.nil? || max...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/validations/inclusion.rb
lib/typed_params/validations/inclusion.rb
# frozen_string_literal: true require 'typed_params/validations/validation' module TypedParams module Validations class Inclusion < Validation def call(value) raise ValidationError, 'is invalid' unless case options in in: Range | Array => e e.include?(value) ...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/validations/validation.rb
lib/typed_params/validations/validation.rb
# frozen_string_literal: true module TypedParams module Validations class Validation def initialize(options) = @options = options def call(value) = raise NotImplementedError def self.wrap(fn) -> v { raise ValidationError, 'is invalid' unless fn.call(v) } end privat...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/formatters/rails.rb
lib/typed_params/formatters/rails.rb
# frozen_string_literal: true require 'typed_params/formatters/formatter' module TypedParams module Formatters ## # The Rails formatter wraps the params in a key matching the current # controller's name. # # For example, in a UsersController context, given the params: # # { email: 'foo...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/formatters/formatter.rb
lib/typed_params/formatters/formatter.rb
# frozen_string_literal: true module TypedParams module Formatters class Formatter attr_reader :decorator, :format def initialize(format, transform:, decorate:) @format = format @transform = transform @decorator = decorate end def decorator? ...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
keygen-sh/typed_params
https://github.com/keygen-sh/typed_params/blob/168deb54e19dd0f8aea55e14f1821089cf8000b3/lib/typed_params/formatters/jsonapi.rb
lib/typed_params/formatters/jsonapi.rb
# frozen_string_literal: true require 'typed_params/formatters/formatter' module TypedParams module Formatters ## # The JSONAPI formatter transforms a JSONAPI document into Rails' # standard params format that can be passed to a model. # # For example, given the following params: # # {...
ruby
MIT
168deb54e19dd0f8aea55e14f1821089cf8000b3
2026-01-04T17:42:43.396590Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/app/helpers/acts_as_bookable/application_helper.rb
app/helpers/acts_as_bookable/application_helper.rb
module ActsAsBookable module ApplicationHelper end end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/app/controllers/acts_as_bookable/application_controller.rb
app/controllers/acts_as_bookable/application_controller.rb
module ActsAsBookable class ApplicationController < ActionController::Base end end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/db/migrate/20160217085200_create_acts_as_bookable_bookings.rb
db/migrate/20160217085200_create_acts_as_bookable_bookings.rb
class CreateActsAsBookableBookings < ActiveRecord::Migration def change create_table :acts_as_bookable_bookings, force: true do |t| t.references :bookable, polymorphic: true, index: {name: "index_acts_as_bookable_bookings_bookable"} t.references :booker, polymorphic: true, index: {name: "index_acts_as...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/spec_helper.rb
spec/spec_helper.rb
require 'coveralls' Coveralls.wear! begin require 'pry-nav' rescue LoadError end $LOAD_PATH << '.' unless $LOAD_PATH.include?('.') $LOAD_PATH.unshift(File.expand_path('../../lib', __FILE__)) require 'logger' require File.expand_path('../../lib/acts_as_bookable', __FILE__) I18n.enforce_available_locales = true requi...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/support/0-helpers.rb
spec/support/0-helpers.rb
def using_sqlite? ActsAsBookable::Utils.connection && ActsAsBookable::Utils.connection.adapter_name == 'SQLite' end def supports_concurrency? !using_sqlite? end def using_postgresql? ActsAsBookable::Utils.using_postgresql? end def postgresql_version if using_postgresql? ActsAsBookable::Utils.connection.e...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/support/1-database.rb
spec/support/1-database.rb
# set adapter to use, default is sqlite3 # to use an alternative adapter run => rake spec DB='postgresql' db_name = ENV['DB'] || 'sqlite3' database_yml = File.expand_path('../../internal/config/database.yml', __FILE__) if File.exist?(database_yml) ActiveRecord::Migration.verbose = false ActiveRecord::Base.default...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/support/3-factory_girl.rb
spec/support/3-factory_girl.rb
RSpec.configure do |config| config.include FactoryGirl::Syntax::Methods config.before(:suite) do begin DatabaseCleaner.start FactoryGirl.lint ensure DatabaseCleaner.clean end end end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/support/2-database_cleaner.rb
spec/support/2-database_cleaner.rb
RSpec.configure do |config| config.before(:suite) do DatabaseCleaner.clean_with(:truncation) DatabaseCleaner.strategy = :transaction DatabaseCleaner.clean end config.after(:suite) do DatabaseCleaner.clean end config.before(:each) do DatabaseCleaner.start end config.after(:each) do ...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/factories/booker.rb
spec/factories/booker.rb
FactoryGirl.define do factory :booker, class: 'Booker' do name 'Booker name' end end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/factories/bookable.rb
spec/factories/bookable.rb
FactoryGirl.define do factory :bookable, class: 'Bookable' do name 'Bookable name' capacity 4 schedule IceCube::Schedule.new end end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/factories/room.rb
spec/factories/room.rb
FactoryGirl.define do factory :room, class: 'Room' do name 'Room name' capacity 4 schedule { schedule = IceCube::Schedule.new(Date.today, duration: 1.day) schedule.add_recurrence_rule IceCube::Rule.daily schedule } end end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/acts_as_bookable/booker_spec.rb
spec/acts_as_bookable/booker_spec.rb
require 'spec_helper' describe 'Booker model' do before(:each) do @booker = build(:booker) end it 'should be valid with all required fields set' do expect(@booker).to be_valid end it 'should save a booker' do expect(@booker.save).to be_truthy end describe 'has_many :bookings' do before...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/acts_as_bookable/booking_spec.rb
spec/acts_as_bookable/booking_spec.rb
require 'spec_helper' describe 'Booking model' do before(:each) do @booking = ActsAsBookable::Booking.new(amount: 2) @booker = create(:booker) @bookable = create(:bookable) @booking.booker = @booker @booking.bookable = @bookable end it 'should be valid with all required fields set' do ex...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/acts_as_bookable/schedule_spec.rb
spec/acts_as_bookable/schedule_spec.rb
require 'spec_helper' describe 'Schedules' do describe "Room schedules" do before :each do @test_from = '2016-02-01'.to_date # it's a monday @schedule = IceCube::Schedule.new @test_from @schedule.add_recurrence_rule IceCube::Rule.weekly.day(:monday,:tuesday,:wednesday,:thursday,:friday) end...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/acts_as_bookable/acts_as_booker_spec.rb
spec/acts_as_bookable/acts_as_booker_spec.rb
require 'spec_helper' describe 'acts_as_booker' do it "should provide a class method 'booker?' that is false for not booker models" do expect(NotBooker).not_to be_booker end describe 'Booker Method Generation' do before :each do NotBooker.acts_as_booker @booker = NotBooker.new() end ...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/acts_as_bookable/bookable_spec.rb
spec/acts_as_bookable/bookable_spec.rb
require 'spec_helper' describe 'Bookable model' do before(:each) do @bookable = build(:bookable) end describe 'conditional validations' do it 'should be valid with all required fields set' do expect(@bookable).to be_valid end it 'should save a bookable' do expect(@bookable.save).to ...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/acts_as_bookable/time_utils_spec.rb
spec/acts_as_bookable/time_utils_spec.rb
require 'spec_helper' describe 'ActsAsBookable::TimeUtils' do describe '#time_in_interval?' do before :each do @interval_start = Time.now @interval_end = Time.now + 1.hour end describe 'returns true' do it 'when time is the interval_start' do time = @interval_start exp...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/acts_as_bookable/acts_as_bookable_spec.rb
spec/acts_as_bookable/acts_as_bookable_spec.rb
require 'spec_helper' describe 'acts_as_bookable' do it "should provide a class method 'bookable?' that is false for unbookable models" do expect(Unbookable).not_to be_bookable end describe 'Bookable Method Generation' do before :each do Unbookable.acts_as_bookable @bookable = Unbookable.new...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/acts_as_bookable/bookable/core_spec.rb
spec/acts_as_bookable/bookable/core_spec.rb
require 'spec_helper' describe 'Bookable model' do describe 'InstanceMethods' do it 'should add a method #check_availability! in instance-side' do @bookable = Bookable.new expect(@bookable).to respond_to :check_availability! end it 'should add a method #check_availability in instance-side' d...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/app/models/NotBooker.rb
spec/internal/app/models/NotBooker.rb
class NotBooker < ActiveRecord::Base end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/app/models/Show.rb
spec/internal/app/models/Show.rb
class Show < ActiveRecord::Base acts_as_bookable preset: :show end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/app/models/Unbookable.rb
spec/internal/app/models/Unbookable.rb
class Unbookable < ActiveRecord::Base end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/app/models/Event.rb
spec/internal/app/models/Event.rb
class Event < ActiveRecord::Base acts_as_bookable preset: :event end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/app/models/Bookable.rb
spec/internal/app/models/Bookable.rb
class Bookable < ActiveRecord::Base acts_as_bookable end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/app/models/Booker.rb
spec/internal/app/models/Booker.rb
class Booker < ActiveRecord::Base acts_as_booker end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/app/models/Room.rb
spec/internal/app/models/Room.rb
class Room < ActiveRecord::Base acts_as_bookable preset: :room end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/app/models/Generic.rb
spec/internal/app/models/Generic.rb
class Generic < ActiveRecord::Base end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/spec/internal/db/schema.rb
spec/internal/db/schema.rb
ActiveRecord::Schema.define version: 0 do create_table :acts_as_bookable_bookings, force: true do |t| t.references :bookable, polymorphic: true, index: {name: "index_acts_as_bookable_bookings_bookable"} t.references :booker, polymorphic: true, index: {name: "index_acts_as_bookable_bookings_booker"} t.colu...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable.rb
lib/acts_as_bookable.rb
require 'active_record' require 'active_record/version' require 'active_support/core_ext/module' require_relative 'acts_as_bookable/engine' if defined?(Rails) require 'ice_cube' IceCube.compatibility = 12 # Drop compatibility for :start_date, avoiding a bunch of warnings caused by serialization module ActsAsBookable ...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/booker.rb
lib/acts_as_bookable/booker.rb
module ActsAsBookable module Booker def self.included(base) base.extend ClassMethods end module ClassMethods ## # Make a model a booker. This allows an instance of a model to claim ownership # of bookings. # # Example: # class User < ActiveRecord::Base # ...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/db_utils.rb
lib/acts_as_bookable/db_utils.rb
module ActsAsBookable module DBUtils class << self def connection ActsAsBookable::Booking.connection end def using_postgresql? connection && connection.adapter_name == 'PostgreSQL' end def using_mysql? #We should probably use regex for mysql to support prehi...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/bookable.rb
lib/acts_as_bookable/bookable.rb
module ActsAsBookable module Bookable def bookable? false end ## # Make a model bookable # # Example: # class Room < ActiveRecord::Base # acts_as_bookable # end def acts_as_bookable(options={}) bookable(options) end private # Make a model boo...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/version.rb
lib/acts_as_bookable/version.rb
module ActsAsBookable VERSION = "0.1.4" end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/booking.rb
lib/acts_as_bookable/booking.rb
module ActsAsBookable ## # Booking model. Store in database bookings made by bookers on bookables # class Booking < ::ActiveRecord::Base self.table_name = 'acts_as_bookable_bookings' belongs_to :bookable, polymorphic: true belongs_to :booker, polymorphic: true validates_presence_of :bookable...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/engine.rb
lib/acts_as_bookable/engine.rb
require 'rails/engine' module ActsAsBookable class Engine < ::Rails::Engine end end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/t.rb
lib/acts_as_bookable/t.rb
module ActsAsBookable module T def self.t(message, opts={}) I18n.t('.acts_as_bookable.' + message, opts) end def self.er(message, opts={}) self.t('errors.messages.' + message, opts) end end end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/time_utils.rb
lib/acts_as_bookable/time_utils.rb
module ActsAsBookable ## # Provide helper functions to manage operations and queries related to times # and schedules # module TimeUtils class << self ## # Check if time is included in a time interval. The ending time is excluded # # @param time The time to check # @param int...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/lib/acts_as_bookable/bookable/core.rb
lib/acts_as_bookable/bookable/core.rb
module ActsAsBookable::Bookable module Core def self.included(base) base.extend ActsAsBookable::Bookable::Core::ClassMethods base.send :include, ActsAsBookable::Bookable::Core::InstanceMethods base.initialize_acts_as_bookable_core end module ClassMethods ## # Initialize the...
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
tandusrl/acts_as_bookable
https://github.com/tandusrl/acts_as_bookable/blob/45b78114e1a5dab96e59fc70933277a56f65b53b/config/routes.rb
config/routes.rb
ActsAsBookable::Engine.routes.draw do end
ruby
MIT
45b78114e1a5dab96e59fc70933277a56f65b53b
2026-01-04T17:42:43.978584Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/test/test_helper.rb
test/test_helper.rb
$LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "leg" require "minitest/autorun" require "minitest/pride" def leg_command(*args) Leg::CLI.new(force_quiet: true).run(args) end
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/test/leg_test.rb
test/leg_test.rb
require "test_helper" class LegTest < Minitest::Test def test_that_it_has_a_version_number refute_nil ::Leg::VERSION end def test_it_does_something_useful assert true end end
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/test/integration/workflow_test.rb
test/integration/workflow_test.rb
require "test_helper" STEP_1 = <<~END int main(void) {} END STEP_2 = <<~END int main(void) { return 0; } END STEP_3 = <<~END int main(void) { printf("Hello, world!\\n"); return 0; } END STEP_4 = <<~END #include <stdio.h> int main(void) { printf("Hello, world!\\n"); return 0; }...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg.rb
lib/leg.rb
require 'erb' require 'fileutils' require 'open3' require 'optparse' require 'redcarpet' require 'rouge' require 'rouge/plugins/redcarpet' require 'rugged' require 'yaml' require 'leg/cli' require 'leg/commands' require 'leg/config' require 'leg/default_templates' require 'leg/diff' require 'leg/diff_transformers' req...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/version.rb
lib/leg/version.rb
module Leg VERSION = "0.0.2" end
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/diff.rb
lib/leg/diff.rb
module Leg class Diff attr_accessor :filename, :is_new_file, :lines def initialize(filename = nil, is_new_file = false, lines = []) @filename = filename @is_new_file = is_new_file @lines = lines end def clone Leg::Diff.new(@filename.dup, @is_new_file, @lines.map(&:clone)) ...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/tutorial.rb
lib/leg/tutorial.rb
module Leg class Tutorial attr_accessor :config attr_reader :pages def initialize(config = nil) @config = config @pages = [] end def <<(page) @pages << page self end def clear @pages.clear end def step(number) cur = 1 @pages.each do |pa...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/default_templates.rb
lib/leg/default_templates.rb
module Leg module DefaultTemplates PAGE = {} STEP = {} PAGE["html"] = <<~TEMPLATE <!doctype html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"> <title><%= page_number %>. <%=...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/diff_transformers.rb
lib/leg/diff_transformers.rb
require 'leg/diff_transformers/base_transformer' require 'leg/diff_transformers/fold_sections' require 'leg/diff_transformers/omit_adjacent_removals' require 'leg/diff_transformers/syntax_highlight' require 'leg/diff_transformers/trim_blank_lines' module Leg module DiffTransformers end end
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/page.rb
lib/leg/page.rb
module Leg class Page attr_accessor :filename, :steps, :footer_text def initialize(filename = "tutorial") @filename = filename @steps = [] @footer_text = nil end def <<(step) @steps << step self end def empty? @steps.empty? end def title fi...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/line.rb
lib/leg/line.rb
module Leg class Line attr_accessor :source, :line_numbers def initialize(source, line_numbers) @source = source.chomp @line_numbers = line_numbers end def clone self.class.new(@source.dup, @line_numbers.dup) end def blank? @source.strip.empty? end def line_...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/representations.rb
lib/leg/representations.rb
require 'leg/representations/base_representation' require 'leg/representations/git' require 'leg/representations/litdiff' module Leg module Representations end end
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/step.rb
lib/leg/step.rb
module Leg class Step attr_accessor :number, :summary, :text, :diffs def initialize(number, summary, text, diffs) @number = number @summary = summary.strip @text = text.strip @diffs = diffs end def to_patch(options = {}) @diffs.map { |diff| diff.to_patch(options) }.join...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/template.rb
lib/leg/template.rb
module Leg module Template def self.render(template_source, tutorial, config, params = {}) Leg::Template::Context.new(template_source, tutorial, config, params).render_template end def self.render_page(page_template, step_template, format, page, tutorial, config) content = "" page.steps...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/cli.rb
lib/leg/cli.rb
module Leg class CLI def initialize(options = {}) @options = options initial_dir = FileUtils.pwd @config = nil last_dir = nil while FileUtils.pwd != last_dir if File.exist?("leg.yml") @config = Leg::Config.new(FileUtils.pwd) @config.load! break...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/markdown.rb
lib/leg/markdown.rb
module Leg module Markdown class HTMLRouge < Redcarpet::Render::HTML include Rouge::Plugins::Redcarpet end HTML_RENDERER = HTMLRouge.new(with_toc_data: true) MARKDOWN_RENDERER = Redcarpet::Markdown.new(HTML_RENDERER, fenced_code_blocks: true) def self.render(source) html = MARKDOWN_R...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands.rb
lib/leg/commands.rb
require 'leg/commands/base_command' module Leg module Commands LIST = [] end end require 'leg/commands/init' require 'leg/commands/build' require 'leg/commands/status' require 'leg/commands/step' require 'leg/commands/diff' require 'leg/commands/commit' require 'leg/commands/amend' require 'leg/commands/save'...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/config.rb
lib/leg/config.rb
module Leg class Config attr_reader :path, :options def initialize(path) @path = path end def load! @options = YAML.load_file(File.join(@path, "leg.yml")) @options = {} unless @options.is_a? Hash @options = symbolize_keys(@options) end def last_synced_at File.m...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/representations/base_representation.rb
lib/leg/representations/base_representation.rb
module Leg module Representations class BaseRepresentation def initialize(config) @config = config end # Should save tutorial to disk. def save!(tutorial, options = {}) raise NotImplementedError end # Should load tutorial from disk, and return it. def lo...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/representations/git.rb
lib/leg/representations/git.rb
module Leg module Representations class Git < BaseRepresentation def save!(tutorial, options = {}) FileUtils.rm_rf(repo_path) FileUtils.mkdir_p(repo_path) FileUtils.cd(repo_path) do repo = Rugged::Repository.init_at(".") step_num = 1 tutorial.pages.eac...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/representations/litdiff.rb
lib/leg/representations/litdiff.rb
module Leg module Representations class Litdiff < BaseRepresentation def save!(tutorial, options = {}) FileUtils.mkdir_p(path) FileUtils.rm_rf(File.join(path, "."), secure: true) step_num = 1 tutorial.pages.each.with_index do |page, page_idx| output = "" ...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/diff_transformers/fold_sections.rb
lib/leg/diff_transformers/fold_sections.rb
module Leg module DiffTransformers class FoldSections < BaseTransformer def transform(diff) sections = @options[:section_types].map { [] } cur_sections = @options[:section_types].map { nil } diff.lines.each.with_index do |line, idx| @options[:section_types].each.with_index...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/diff_transformers/trim_blank_lines.rb
lib/leg/diff_transformers/trim_blank_lines.rb
module Leg module DiffTransformers class TrimBlankLines < BaseTransformer def transform(diff) new_diff = diff.clone_empty diff.lines.each.with_index do |line, idx| line = line.clone if line.blank? && [:added, :removed].include?(line.type) prev_line = idx > 0 ?...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/diff_transformers/base_transformer.rb
lib/leg/diff_transformers/base_transformer.rb
module Leg module DiffTransformers class BaseTransformer def initialize(options = {}) @options = options end def transform(diff) raise NotImplementedError end end end end
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/diff_transformers/syntax_highlight.rb
lib/leg/diff_transformers/syntax_highlight.rb
module Leg module DiffTransformers class SyntaxHighlight < BaseTransformer class HTMLLineByLine < Rouge::Formatter def initialize(formatter) @formatter = formatter end def stream(tokens, &b) token_lines(tokens) do |line| line.each do |tok, val| ...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/diff_transformers/omit_adjacent_removals.rb
lib/leg/diff_transformers/omit_adjacent_removals.rb
module Leg module DiffTransformers class OmitAdjacentRemovals < BaseTransformer def transform(diff) new_diff = diff.clone removed_lines = [] saw_added_line = false new_diff.lines.each.with_index do |line, idx| case line.type when :unchanged, :folded ...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/diff.rb
lib/leg/commands/diff.rb
module Leg module Commands class Diff < BaseCommand def self.name "diff" end def self.summary "Compare last step with changes made in step/." end def self.usage "" end def setopts!(o) end def run needs! :config, :repo ...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/resolve.rb
lib/leg/commands/resolve.rb
module Leg module Commands class Resolve < BaseCommand def self.name "resolve" end def self.summary "Continue rewriting steps after resolving a merge conflict." end def self.usage "" end def setopts!(o) end def run needs! :c...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/base_command.rb
lib/leg/commands/base_command.rb
module Leg module Commands class BaseCommand attr_reader :config, :opts def initialize(args, config) @args = args @config = config @git = Leg::Representations::Git.new(@config) @litdiff = Leg::Representations::Litdiff.new(@config) parseopts! end de...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/build.rb
lib/leg/commands/build.rb
module Leg module Commands class Build < BaseCommand def self.name "build" end def self.summary "Render repo/ into an HTML or Markdown book." end def self.usage "[-q]" end def setopts!(o) o.on("-q", "--quiet", "Don't output progress") do...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/step.rb
lib/leg/commands/step.rb
module Leg module Commands class Step < BaseCommand def self.name "step" end def self.summary "Select a step for editing." end def self.usage "<step-number>" end def setopts!(o) end def run needs! :config, :repo ste...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/help.rb
lib/leg/commands/help.rb
module Leg module Commands class Help < BaseCommand def self.name "help" end def self.summary "Print out list of commands, or get help\n" + "on a specific command." end def self.usage "[<command>]" end def setopts!(o) end de...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/save.rb
lib/leg/commands/save.rb
module Leg module Commands class Save < BaseCommand def self.name "save" end def self.summary "Save changes to doc/." end def self.usage "" end def setopts!(o) end def run needs! :config, :repo if @git.rebase_remain...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/amend.rb
lib/leg/commands/amend.rb
module Leg module Commands class Amend < BaseCommand def self.name "amend" end def self.summary "Modify a step." end def self.usage "[-s]" end def setopts!(o) o.on("-m", "--message MESSAGE", "Set the step summary to MESSAGE") do |m| ...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/init.rb
lib/leg/commands/init.rb
module Leg module Commands class Init < BaseCommand def self.name "init" end def self.summary "Initialize a new leg project." end def self.usage "[new-dir]" end def setopts!(o) end def run if @config puts "You are ...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/status.rb
lib/leg/commands/status.rb
module Leg module Commands class Status < BaseCommand def self.name "status" end def self.summary "Show unsaved changes and the state of the step/ folder." end def self.usage "" end def setopts!(o) end def run needs! :config...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/commit.rb
lib/leg/commands/commit.rb
module Leg module Commands class Commit < BaseCommand def self.name "commit" end def self.summary "Append or insert a new step." end def self.usage "[-s]" end def setopts!(o) o.on("-m", "--message MESSAGE", "Set the step summary to MESSA...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false
snaptoken/leg
https://github.com/snaptoken/leg/blob/41f5a51b03dab5e58142f6722a98c41dd147d567/lib/leg/commands/reset.rb
lib/leg/commands/reset.rb
module Leg module Commands class Reset < BaseCommand def self.name "reset" end def self.summary "Abort any saves in progress and checkout the top-most step." end def self.usage "" end def setopts!(o) end def run needs! :conf...
ruby
MIT
41f5a51b03dab5e58142f6722a98c41dd147d567
2026-01-04T17:42:46.302709Z
false