source
stringclasses
1 value
repo
stringlengths
5
63
repo_url
stringlengths
24
82
path
stringlengths
5
167
language
stringclasses
1 value
license
stringclasses
5 values
stars
int64
10
51.4k
ref
stringclasses
23 values
size_bytes
int64
200
258k
text
stringlengths
137
258k
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/versioned_commands.rb
Ruby
mit
191
master
6,017
# frozen_string_literal: true require_relative 'versioned_commands/command_migration' require_relative 'versioned_commands/migration_context' require_relative 'versioned_commands/migrator' require_relative 'versioned_commands/schema_table' module Torque module PostgreSQL # Takes advantage of Rails migrations to...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/config.rb
Ruby
mit
191
master
13,410
# frozen_string_literal: true module Torque module PostgreSQL include ActiveSupport::Configurable # Use the same logger as the Active Record one def self.logger ActiveRecord::Base.logger end # Allow nested configurations # :TODO: Rely on +inheritable_copy+ to make nested configuration...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/inheritance.rb
Ruby
mit
191
master
7,657
# frozen_string_literal: true module Torque module PostgreSQL InheritanceError = Class.new(ArgumentError) module Inheritance extend ActiveSupport::Concern # Cast the given object to its correct class def cast_record record_class_value = send(self.class._record_class_attribute) ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/railtie.rb
Ruby
mit
191
master
6,331
# frozen_string_literal: true module Torque module PostgreSQL # = Torque PostgreSQL Railtie class Railtie < Rails::Railtie # :nodoc: # Get information from the running rails app initializer 'torque-postgresql' do |app| ActiveSupport.on_load(:active_record_postgresqladapter) do A...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/predicate_builder.rb
Ruby
mit
191
master
977
# frozen_string_literal: true require_relative 'predicate_builder/array_handler' require_relative 'predicate_builder/regexp_handler' require_relative 'predicate_builder/arel_attribute_handler' require_relative 'predicate_builder/enumerator_lazy_handler' module Torque module PostgreSQL module PredicateBuilder ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/arel.rb
Ruby
mit
191
master
213
require_relative 'arel/infix_operation' require_relative 'arel/join_source' require_relative 'arel/nodes' require_relative 'arel/operations' require_relative 'arel/select_manager' require_relative 'arel/visitors'
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/auxiliary_statement.rb
Ruby
mit
191
master
11,070
# frozen_string_literal: true require_relative 'auxiliary_statement/settings' require_relative 'auxiliary_statement/recursive' module Torque module PostgreSQL class AuxiliaryStatement TABLE_COLUMN_AS_STRING = /\A(?:"?(\w+)"?\.)?"?(\w+)"?\z/.freeze class << self attr_reader :config, :table_n...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/geometry_builder.rb
Ruby
mit
191
master
2,394
# frozen_string_literal: true module Torque module PostgreSQL class GeometryBuilder < ActiveModel::Type::Value DESTRUCTOR = /[<>{}()]/.freeze NUMBER_SERIALIZER = ->(num) { num.to_s.gsub(/\.0$/, '') } def type return self.class.const_get('TYPE') if self.class.const_defined?('TYPE') ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/collector.rb
Ruby
mit
191
master
824
# frozen_string_literal: true module Torque module PostgreSQL module Collector # This class helps to collect data in different ways. Used to configure # auxiliary statements def self.new(*args) klass = Class.new args.flatten! args.compact! klass.module_eval do...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/autosave_association.rb
Ruby
mit
191
master
1,558
# frozen_string_literal: true module Torque module PostgreSQL module AutosaveAssociation module ClassMethods # Since belongs to many is a collection, the callback would normally go # to +after_create+. However, since it is a +belongs_to+ kind of # association, it neds to be executed...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/reflection/association_reflection.rb
Ruby
mit
191
master
1,805
# frozen_string_literal: true module Torque module PostgreSQL module Reflection module AssociationReflection def initialize(name, scope, options, active_record) super raise ArgumentError, <<-MSG.squish if options[:array] && options[:polymorphic] Associations can't ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/reflection/runtime_reflection.rb
Ruby
mit
191
master
354
# frozen_string_literal: true module Torque module PostgreSQL module Reflection module RuntimeReflection delegate :klass, :active_record, :connected_through_array?, :macro, :name, :array_attribute, to: :@reflection end ::ActiveRecord::Reflection::RuntimeReflection.include(Run...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/reflection/through_reflection.rb
Ruby
mit
191
master
315
# frozen_string_literal: true module Torque module PostgreSQL module Reflection module ThroughReflection delegate :build_id_constraint, :connected_through_array?, to: :source_reflection end ::ActiveRecord::Reflection::ThroughReflection.include(ThroughReflection) end end end
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/reflection/belongs_to_many_reflection.rb
Ruby
mit
191
master
1,632
# frozen_string_literal: true module Torque module PostgreSQL module Reflection class BelongsToManyReflection < ::ActiveRecord::Reflection::AssociationReflection def macro :belongs_to_many end def connected_through_array? true end def belongs_to...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/reflection/has_many_reflection.rb
Ruby
mit
191
master
382
# frozen_string_literal: true module Torque module PostgreSQL module Reflection module HasManyReflection def connected_through_array? options[:array] end def array_attribute klass.arel_table[foreign_key] end end ::ActiveRecord::Reflection::H...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/reflection/abstract_reflection.rb
Ruby
mit
191
master
1,896
# frozen_string_literal: true module Torque module PostgreSQL module Reflection module AbstractReflection AREL_ATTR = ::Arel::Attributes::Attribute AREL_NODE = ::Arel::Nodes::Node # Check if the foreign key actually exists def connected_through_array? false ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/auxiliary_statement/settings.rb
Ruby
mit
191
master
3,694
# frozen_string_literal: true module Torque module PostgreSQL class AuxiliaryStatement class Settings < Collector.new(:attributes, :join, :join_type, :query, :requires, :polymorphic, :through, :union_all, :connect) attr_reader :base, :source, :depth, :path alias_method :select, :...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/auxiliary_statement/recursive.rb
Ruby
mit
191
master
5,639
# frozen_string_literal: true module Torque module PostgreSQL class AuxiliaryStatement class Recursive < AuxiliaryStatement # Setup any additional option in the recursive mode def initialize(*, **options) super @connect = options[:connect]&.to_a&.first @union_...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/enum.rb
Ruby
mit
191
master
6,979
# frozen_string_literal: true module Torque module PostgreSQL module Attributes class Enum < String include Comparable class EnumError < ArgumentError; end LAZY_VALUE = 0.chr class << self include Enumerable delegate :each, :sample, :size, :length, to...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/lazy.rb
Ruby
mit
191
master
559
# frozen_string_literal: true module Torque module PostgreSQL module Attributes class Lazy < BasicObject def initialize(klass, *values) @klass, @values = klass, values end def ==(other) other.nil? end def nil? true end ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/builder.rb
Ruby
mit
191
master
2,357
# frozen_string_literal: true require_relative 'builder/enum' require_relative 'builder/period' require_relative 'builder/full_text_search' module Torque module PostgreSQL module Attributes module Builder def self.include_on(klass, method_name, builder_klass, **extra, &block) klass.defin...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/full_text_search.rb
Ruby
mit
191
master
584
# frozen_string_literal: true module Torque module PostgreSQL module Attributes # For now, full text search doesn't have it's own class module FullTextSearch class << self # Provide a method on the given class to setup which full text search # columns will be manually init...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/period.rb
Ruby
mit
191
master
538
# frozen_string_literal: true module Torque module PostgreSQL module Attributes # For now, period doesn't have it's own class module Period class << self # Provide a method on the given class to setup which period columns # will be manually initialized def includ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/enum_set.rb
Ruby
mit
191
master
8,031
# frozen_string_literal: true module Torque module PostgreSQL module Attributes class EnumSet < Set include Comparable class EnumSetError < Enum::EnumError; end class << self include Enumerable delegate :each, to: :members delegate :values, :keys, :m...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/builder/full_text_search.rb
Ruby
mit
191
master
3,889
# frozen_string_literal: true module Torque module PostgreSQL module Attributes module Builder class FullTextSearch attr_accessor :klass, :attribute, :options, :klass_module, :default_rank, :default_mode, :default_order, :default_language def initialize(klass, attri...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/builder/enum.rb
Ruby
mit
191
master
9,449
# frozen_string_literal: true module Torque module PostgreSQL module Attributes module Builder class Enum VALID_TYPES = %i[enum enum_set].freeze FN = '::Torque::PostgreSQL::FN' attr_accessor :klass, :attribute, :subtype, :options, :values, :klass_module, :...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/attributes/builder/period.rb
Ruby
mit
191
master
19,934
# frozen_string_literal: true module Torque module PostgreSQL module Attributes module Builder class Period DIRECT_ACCESS_REGEX = /_?%s_?/ SUPPORTED_TYPES = %i[daterange tsrange tstzrange].freeze CURRENT_GETTERS = { daterange: 'Date.current', ts...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/relation/inheritance.rb
Ruby
mit
191
master
4,247
# frozen_string_literal: true module Torque module PostgreSQL module Relation module Inheritance # :nodoc: def cast_records_values @values.fetch(:cast_records, FROZEN_EMPTY_ARRAY) end # :nodoc: def cast_records_values=(value) assert_modifiable! ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/relation/merger.rb
Ruby
mit
191
master
2,250
# frozen_string_literal: true module Torque module PostgreSQL module Relation module Merger def merge # :nodoc: super merge_select_extra merge_distinct_on merge_auxiliary_statements merge_inheritance merge_buckets relation ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/relation/distinct_on.rb
Ruby
mit
191
master
1,332
# frozen_string_literal: true module Torque module PostgreSQL module Relation module DistinctOn # :nodoc: def distinct_on_values @values.fetch(:distinct_on, FROZEN_EMPTY_ARRAY) end # :nodoc: def distinct_on_values=(value) assert_modifiable! ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/relation/buckets.rb
Ruby
mit
191
master
4,104
# frozen_string_literal: true module Torque module PostgreSQL module Relation module Buckets # :nodoc: def buckets_value @values.fetch(:buckets, nil) end # :nodoc: def buckets_value=(value) assert_modifiable! @values[:buckets] = value ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/relation/auxiliary_statement.rb
Ruby
mit
191
master
3,065
# frozen_string_literal: true module Torque module PostgreSQL module Relation module AuxiliaryStatement # :nodoc: def auxiliary_statements_values @values.fetch(:auxiliary_statements, FROZEN_EMPTY_ARRAY) end # :nodoc: def auxiliary_statements_values=(value)...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/relation/join_series.rb
Ruby
mit
191
master
4,319
# frozen_string_literal: true module Torque module PostgreSQL module Relation module JoinSeries # Create the proper arel join class << self def build(relation, range, with: nil, as: :series, step: nil, time_zone: nil, cast: nil, mode: :inner, &block) validate_build!(r...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/schema_cache/inheritance.rb
Ruby
mit
191
master
4,371
# frozen_string_literal: true module Torque module PostgreSQL module SchemaCache module Inheritance # Try to find a model based on a given table def lookup_model(table_name, scoped_class = '', source_to_model:) scoped_class = scoped_class.name if scoped_class.is_a?(Class) ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/schema_cache/bound_schema_reflection.rb
Ruby
mit
191
master
901
# frozen_string_literal: true module Torque module PostgreSQL module BoundSchemaReflection def add_model_name(table_name, model) source = defined?(@pool) ? @pool : @connection @schema_reflection.add_model_name(source, table_name, model) end def dependencies(table_name) ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/schema_cache/schema_reflection.rb
Ruby
mit
191
master
665
# frozen_string_literal: true module Torque module PostgreSQL module SchemaReflection def add_model_name(source, table_name, model) cache(source).add_model_name(source, table_name, model) end def dependencies(source, table_name) cache(source).dependencies(source, table_name) ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/predicate_builder/enumerator_lazy_handler.rb
Ruby
mit
191
master
917
# frozen_string_literal: true module Torque module PostgreSQL module PredicateBuilder class EnumeratorLazyHandler < ::ActiveRecord::PredicateBuilder::ArrayHandler Timeout = Class.new(::Timeout::Error) def call(attribute, value) with_timeout do super(attribute, limit.n...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/predicate_builder/regexp_handler.rb
Ruby
mit
191
master
487
# frozen_string_literal: true module Torque module PostgreSQL module PredicateBuilder class RegexpHandler def initialize(predicate_builder) @predicate_builder = predicate_builder end def call(attribute, value) operator = value.casefold? ? :"~*" : :"~" ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/predicate_builder/array_handler.rb
Ruby
mit
191
master
1,300
# frozen_string_literal: true module Torque module PostgreSQL module PredicateBuilder module ArrayHandler def call(attribute, value) return super unless array_attribute?(attribute) && PostgreSQL.config.predicate_builder.handle_array_attributes call_for_array(attribu...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/predicate_builder/arel_attribute_handler.rb
Ruby
mit
191
master
848
# frozen_string_literal: true module Torque module PostgreSQL module PredicateBuilder class ArelAttributeHandler # Shortcut def self.call(*args) new.call(*args) end def initialize(*) # There is no need to use or save the predicate builder here en...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/schema_dumper.rb
Ruby
mit
191
master
7,001
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module SchemaDumper SEARCH_VECTOR_SCANNER = / to_tsvector\( ('[^']+'|[a-z][a-z0-9_]*)[^,]*,[^\(]* \(?coalesce\(([a-z][a-z0-9_]*)[^\)]*\)\)? (?:::[^\)]*\))? (?:\s*,\s*'(...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/schema_definitions.rb
Ruby
mit
191
master
2,618
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module ColumnMethods # Adds a search language column to the table. See +add_search_language+ def search_language(*names, **options) raise ArgumentError, "Missing column name(s) for search_language" if na...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/schema_statements.rb
Ruby
mit
191
master
8,021
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module SchemaStatements # Drops a type def drop_type(name, options = {}) force = options.fetch(:force, '').upcase check = 'IF EXISTS' if options.fetch(:check, true) name = sanitize_nam...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/schema_overrides.rb
Ruby
mit
191
master
1,569
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module SchemaOverrides # This adds better support for handling the quotation of table names def quote_table_name(name) ActiveRecord::ConnectionAdapters::PostgreSQL::Quoting::QUOTED_TABLE_NAMES.then do |m|...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/schema_creation.rb
Ruby
mit
191
master
690
module Torque module PostgreSQL module Adapter module SchemaCreation # Inherits are now setup via table options, but keep the implementation # supported by this gem def add_table_options!(create_sql, o) if o.inherits.present? # Make sure we always have parenthe...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/database_statements.rb
Ruby
mit
191
master
8,640
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module DatabaseStatements EXTENDED_DATABASE_TYPES = %i[enum enum_set interval] # Switch between dump mode or not def dump_mode! @_dump_mode = !!!@_dump_mode end # List of schema...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/quoting.rb
Ruby
mit
191
master
1,691
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module Quoting QUOTED_TYPE_NAMES = Concurrent::Map.new Name = ActiveRecord::ConnectionAdapters::PostgreSQL::Name Column = ActiveRecord::ConnectionAdapters::PostgreSQL::Column ColumnDefinition = Act...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/box.rb
Ruby
mit
191
master
655
# frozen_string_literal: true module Torque module PostgreSQL class Box < Struct.new(:x1, :y1, :x2, :y2) def points klass = Torque::PostgreSQL.config.geometry.point_class [ klass.new(x1, y1), klass.new(x1, y2), klass.new(x2, y1), klass.new(x2, y2), ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/line.rb
Ruby
mit
191
master
1,240
# frozen_string_literal: true module Torque module PostgreSQL class Line < Struct.new(:slope, :intercept) alias c intercept alias c= intercept= def a=(value) self.slope = vertical? ? Float::INFINITY : Rational(value, b) end def a slope.numerator end de...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/enum_set.rb
Ruby
mit
191
master
1,259
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module OID class EnumSet < Enum def initialize(name, enum_klass) @name = name + '[]' @klass = Attributes::EnumSet.lookup(name, enum_klass) @set_klass = self @enum...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/interval.rb
Ruby
mit
191
master
3,559
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module OID class Interval < ActiveModel::Type::Value CAST_PARTS = [:years, :months, :days, :hours, :minutes, :seconds] def type :interval end # Accepts database-style ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/segment.rb
Ruby
mit
191
master
1,499
# frozen_string_literal: true module Torque module PostgreSQL class Segment < Struct.new(:point0, :point1) def x1=(value) self.point0 = new_point(value, y1) end def x1 point0.x end def y1=(value) self.point0 = new_point(x1, value) end def y1 ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/range.rb
Ruby
mit
191
master
1,824
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module OID class Range < ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Range HASH_PICK = %i[from start end to].freeze module Comparison def <=>(other) return super unless...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/circle.rb
Ruby
mit
191
master
805
# frozen_string_literal: true module Torque module PostgreSQL class Circle < Struct.new(:x, :y, :r) alias radius r alias radius= r= def center point_class.new(x, y) end def center=(value) parts = value.is_a?(point_class) ? [value.x, value.y] : value[0..1] s...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/enum.rb
Ruby
mit
191
master
1,780
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module OID class Enum < ActiveRecord::ConnectionAdapters::PostgreSQL::OID::Enum attr_reader :name, :klass, :set_klass, :enum_klass def self.create(row, type_map) name = row['typname'] ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/adapter/oid/array.rb
Ruby
mit
191
master
384
# frozen_string_literal: true module Torque module PostgreSQL module Adapter module OID module Array def force_equality?(value) PostgreSQL.config.predicate_builder.handle_array_attributes ? false : super end end ::ActiveRecord::ConnectionAdapters::Po...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/arel/infix_operation.rb
Ruby
mit
191
master
1,084
# frozen_string_literal: true module Torque module PostgreSQL module Arel Math = Module.new def self.build_operations(operations) default_alias = :visit_Arel_Nodes_InfixOperation operations&.each do |name, operator| klass_name = name.to_s.camelize next if ::Arel:...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/arel/join_source.rb
Ruby
mit
191
master
268
# frozen_string_literal: true module Torque module PostgreSQL module Arel module JoinSource attr_accessor :only def only? only === true end end ::Arel::Nodes::JoinSource.include JoinSource end end end
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/arel/operations.rb
Ruby
mit
191
master
668
# frozen_string_literal: true module Torque module PostgreSQL module Arel module Operations # Create a cast operation def pg_cast(type, array = false) Nodes::Cast.new(self, type, array) end # Make sure to add proper support over AR's own +cast+ method while ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/arel/nodes.rb
Ruby
mit
191
master
1,211
# frozen_string_literal: true module Torque module PostgreSQL module Arel module Nodes class Cast < ::Arel::Nodes::Binary include ::Arel::Expressions include ::Arel::Predications include ::Arel::AliasPredication include ::Arel::OrderPredications in...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/arel/select_manager.rb
Ruby
mit
191
master
252
# frozen_string_literal: true module Torque module PostgreSQL module Arel module SelectManager def only @ctx.source.only = true end end ::Arel::SelectManager.include SelectManager end end end
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/arel/visitors.rb
Ruby
mit
191
master
1,439
# frozen_string_literal: true module Torque module PostgreSQL module Arel module Visitors # Add ONLY modifier to query def visit_Arel_Nodes_JoinSource(o, collector) collector << 'ONLY ' if o.only? super end # Allow quoted arrays to get here def v...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/versioned_commands/generator.rb
Ruby
mit
191
master
1,766
# frozen_string_literal: true require 'rails/generators/base' require 'rails/generators/active_record/migration' module Torque module PostgreSQL module VersionedCommands module Generator TEMPLATES_PATH = '../../../generators/torque/templates' attr_reader :file_name def self.inclu...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/versioned_commands/migrator.rb
Ruby
mit
191
master
1,162
# frozen_string_literal: true module Torque module PostgreSQL module VersionedCommands module Migrator def execute_migration_in_transaction(migration) @versioned_command = versioned_command?(migration) && migration super ensure @versioned_command = false ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/versioned_commands/migration_context.rb
Ruby
mit
191
master
3,102
# frozen_string_literal: true module Torque module PostgreSQL class IllegalCommandTypeError < ActiveRecord::MigrationError def initialize(file) super(<<~MSG.squish) Illegal name for command file '#{file}'. Commands are more strict and require the version, one of create, update, ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/versioned_commands/command_migration.rb
Ruby
mit
191
master
4,465
# frozen_string_literal: true module Torque module PostgreSQL module VersionedCommands module Migration def initialize(*args) @command = args.pop super(*args) end # Prepare the description based on the direction def migrate(direction) @descript...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/versioned_commands/schema_table.rb
Ruby
mit
191
master
2,894
# frozen_string_literal: true module Torque module PostgreSQL module VersionedCommands class SchemaTable attr_reader :arel_table def initialize(pool) @pool = pool @arel_table = ::Arel::Table.new(table_name) end def create_version(command) im =...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/migration/command_recorder.rb
Ruby
mit
191
master
773
# frozen_string_literal: true module Torque module PostgreSQL module Migration module CommandRecorder # Records the rename operation for types def rename_type(*args, &block) record(:rename_type, args, &block) end # Inverts the type rename operation def in...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/associations/association_scope.rb
Ruby
mit
191
master
2,503
# frozen_string_literal: true module Torque module PostgreSQL module Associations module AssociationScope # A customized predicate builder for array attributes that can be used # standalone and changes the behavior of the blank state class PredicateBuilderArray include Pre...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/associations/belongs_to_many_association.rb
Ruby
mit
191
master
8,319
# frozen_string_literal: true require 'active_record/associations/collection_association' # FIXME: build, create module Torque module PostgreSQL module Associations class BelongsToManyAssociation < ::ActiveRecord::Associations::CollectionAssociation include ::ActiveRecord::Associations::ForeignAss...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/associations/foreign_association.rb
Ruby
mit
191
master
1,218
# frozen_string_literal: true module Torque module PostgreSQL module Associations module ForeignAssociation # There is no problem of adding temporary items on target because # CollectionProxy will handle memory and persisted relationship def inversed_from(record) return s...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/associations/builder/has_many.rb
Ruby
mit
191
master
325
# frozen_string_literal: true module Torque module PostgreSQL module Associations module Builder module HasMany def valid_options(options) super + [:array] end end ::ActiveRecord::Associations::Builder::HasMany.extend(HasMany) end end end...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/associations/builder/belongs_to_many.rb
Ruby
mit
191
master
4,808
# frozen_string_literal: true module Torque module PostgreSQL module Associations module Builder class BelongsToMany < ::ActiveRecord::Associations::Builder::CollectionAssociation def self.macro :belongs_to_many end def self.valid_options(options) ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/associations/preloader/association.rb
Ruby
mit
191
master
4,469
# frozen_string_literal: true module Torque module PostgreSQL module Associations module Preloader module Association delegate :connected_through_array?, to: :@reflection # For reflections connected through an array, make sure to properly # decuple the list of ids an...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/torque/postgresql/associations/preloader/loader_query.rb
Ruby
mit
191
master
982
# frozen_string_literal: true module Torque module PostgreSQL module Associations module Preloader module LoaderQuery def foreign_column @foreign_column ||= scope.columns_hash[association_key_name.to_s] end def load_records_for_keys(keys, &block) ...
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/generators/torque/function_generator.rb
Ruby
mit
191
master
314
# frozen_string_literal: true require 'torque/postgresql/versioned_commands/generator' module Torque module Generators class FunctionGenerator < Rails::Generators::Base include Torque::PostgreSQL::VersionedCommands::Generator alias create_function_file create_migration_file end end end
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/generators/torque/type_generator.rb
Ruby
mit
191
master
306
# frozen_string_literal: true require 'torque/postgresql/versioned_commands/generator' module Torque module Generators class TypeGenerator < Rails::Generators::Base include Torque::PostgreSQL::VersionedCommands::Generator alias create_type_file create_migration_file end end end
github
crashtech/torque-postgresql
https://github.com/crashtech/torque-postgresql
lib/generators/torque/view_generator.rb
Ruby
mit
191
master
453
# frozen_string_literal: true require 'torque/postgresql/versioned_commands/generator' module Torque module Generators class ViewGenerator < Rails::Generators::Base include Torque::PostgreSQL::VersionedCommands::Generator class_option :materialized, type: :boolean, aliases: %i(--m), default: false,...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
Gemfile
Ruby
mit
192
master
405
source "https://rubygems.org" gemspec if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.1.0") gem "rspec-benchmark", "~> 0.6" end gem "json", "2.4.1" if RUBY_VERSION == "2.0.0" group :test do if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("2.5.0") gem "coveralls_reborn", "~> 0.21.0" gem "si...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
tty-box.gemspec
Ruby
mit
192
master
1,397
# frozen_string_literal: true require_relative "lib/tty/box/version" Gem::Specification.new do |spec| spec.name = "tty-box" spec.version = TTY::Box::VERSION spec.authors = ["Piotr Murach"] spec.email = ["piotr@piotrmurach.com"] spec.summary = %q{Draw various frames and box...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
tasks/spec.rake
Ruby
mit
192
master
838
# frozen_string_literal: true begin require "rspec/core/rake_task" desc "Run all specs" RSpec::Core::RakeTask.new(:spec) do |task| task.pattern = "spec/{unit,integration}{,/*/**}/*_spec.rb" end namespace :spec do desc "Run unit specs" RSpec::Core::RakeTask.new(:unit) do |task| task.patter...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
tasks/console.rake
Ruby
mit
192
master
226
# frozen_string_literal: true desc "Load gem inside irb console" task :console do require "irb" require "irb/completion" require File.join(__FILE__, "../../lib/tty-box") ARGV.clear IRB.start end task c: %w[console]
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
lib/tty/box.rb
Ruby
mit
192
master
13,608
# frozen_string_literal: true require "strings" require "pastel" require "tty-cursor" require_relative "box/border" require_relative "box/version" module TTY # Responsible for drawing a box around content # # @api public class Box NEWLINE = "\n" SPACE = " " LINE_BREAK = /\r\n|\r|\n/.freeze #...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
lib/tty/box/border.rb
Ruby
mit
192
master
5,461
# frozen_string_literal: true module TTY class Box # A class reponsible for retrieving border options # # @api private class Border BOX_CHARS = { ascii: %w[+ + + + + + + + - | +], light: %w[┘ ┐ ┌ └ ┤ ┴ ┬ ├ ─ │ ┼], thick: %w[╝ ╗ ╔ ╚ ╣ ╩ ╦ ╠ ═ ║ ╬] }.freeze BO...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
examples/connected.rb
Ruby
mit
192
master
653
# frozen_string_literal: true require_relative "../lib/tty-box" print TTY::Cursor.clear_screen box1 = TTY::Box.frame( top: 3, left: 10, width: 15, height: 5, border: { type: :thick, right: false }, align: :center, padding: [1, 2], style: { bg: :red, border: { bg: :red } ...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
examples/commander.rb
Ruby
mit
192
master
784
# frozen_string_literal: true require_relative "../lib/tty-box" print TTY::Cursor.clear_screen box1 = TTY::Box.frame( top: 2, left: 10, width: 30, height: 10, border: :thick, align: :center, padding: 3, title: { top_left: " file1 " }, style: { fg: :bright_yellow, bg: :blue, border...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
examples/messages.rb
Ruby
mit
192
master
348
# frozen_string_literal: true require_relative "../lib/tty-box" puts TTY::Cursor.clear_screen puts TTY::Box.info "Deploying application", top: 2, left: 2 puts TTY::Box.success "Deploying application", top: 2, left: 29 puts TTY::Box.warn "Deploying application", top: 8, left: 2 puts TTY::Box.error "Deploying applicati...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/spec_helper.rb
Ruby
mit
192
master
730
# frozen_string_literal: true if ENV["COVERAGE"] == "true" require "simplecov" require "coveralls" SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ SimpleCov::Formatter::HTMLFormatter, Coveralls::SimpleCov::Formatter ] SimpleCov.start do command_name "spec" add_filter "spec" en...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/align_spec.rb
Ruby
mit
192
master
1,090
# frozen_string_literal: true RSpec.describe TTY::Box, ":align option" do it "aligns content without positioning" do box = TTY::Box.frame(width: 26, height: 4, align: :center) do "Drawing a box in terminal emulator" end expect(box).to eq([ "┌────────────────────────┐\n", "│ Drawing a...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/style_spec.rb
Ruby
mit
192
master
3,707
# frozen_string_literal: true RSpec.describe TTY::Box, ":style option" do it "applies styling to content and border" do box = TTY::Box.new( enable_color: true, top: 0, left: 0, width: 30, height: 4, border: :thick, title: { top_left: " file1 " }, styl...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/frame_spec.rb
Ruby
mit
192
master
6,317
# frozen_string_literal: true RSpec.describe TTY::Box, "#frame" do it "creates frame without content & width & height values" do output = TTY::Box.frame expect(output).to eq([ "┌─┐\n", "└─┘\n" ].join) end it "creates frame around single character content without width & height" do o...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/custom_frame_spec.rb
Ruby
mit
192
master
3,079
# frozen_string_literal: true RSpec.describe TTY::Box, "custom frames" do it "draws info type message" do box = TTY::Box.info("Hello world!", enable_color: true) expect(box).to eq([ "\e[104m\e[30m╔\e[0m\e[0m\e[104m\e[30m ℹ INFO \e[0m\e[0m\e[104m\e[30m═══\e[0m\e[0m\e[104m\e[30m═══\e[0m\e[0m\e[104m\e[30...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/border_spec.rb
Ruby
mit
192
master
3,976
# frozen_string_literal: true RSpec.describe TTY::Box, ":border option" do it "creates frame with double lines and no position" do box = TTY::Box.frame( width: 35, height: 4, border: :thick ) expect(box).to eq([ "╔═════════════════════════════════╗\n", "║ ...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/title_spec.rb
Ruby
mit
192
master
1,952
# frozen_string_literal: true RSpec.describe TTY::Box, ":title option" do it "allows to specify top border titles" do output = TTY::Box.frame( top: 0, left: 0, width: 35, height: 4, title: { top_left: "left", top_right: "right", top_center: "center" } ) ex...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/position_spec.rb
Ruby
mit
192
master
1,278
# frozen_string_literal: true RSpec.describe TTY::Box, ":top, :left options" do it "skips positioning when no top & left values provided" do box = TTY::Box.new(width: 35, height: 4) expect(box.top).to eq(nil) expect(box.left).to eq(nil) expect(box.position?).to eq(false) expect(box.render).to e...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/padding_spec.rb
Ruby
mit
192
master
3,326
# frozen_string_literal: true RSpec.describe TTY::Box, ":padding option" do it "padds internal content without width and height" do box = TTY::Box.frame(padding: 1) do "Drawing a box in terminal emulator" end expect(box).to eq([ "┌────────────────────────────────────┐\n", "│ ...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/new_spec.rb
Ruby
mit
192
master
2,488
# frozen_string_literal: true RSpec.describe TTY::Box, ".new" do it "calculates dimensions for a box with border and single line content" do box = TTY::Box.new("Hello world") expect(box.width).to eq(13) expect(box.height).to eq(3) expect(box.content_width).to eq(11) expect(box.content_height).to...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/unit/border/parse_spec.rb
Ruby
mit
192
master
2,669
# frozen_string_literal: true RSpec.describe TTY::Box::Border, ".parse" do it "parses default border" do border = TTY::Box::Border.parse({}) top_border = [border.top_left, border.top, border.top_right] bottom_border = [border.bottom_left, border.bottom, border.bottom_right] expect(border.type).to eq...
github
piotrmurach/tty-box
https://github.com/piotrmurach/tty-box
spec/perf/frame_spec.rb
Ruby
mit
192
master
567
# frozen_string_literal: true require "rspec-benchmark" require "yaml" RSpec.describe TTY::Box do include RSpec::Benchmark::Matchers let(:output) { StringIO.new } it "displays box 12.5x slower than YAML output" do content = "Hello World" expect { TTY::Box.frame(content) }.to perform_slower_...
github
itteco/service_merchant
https://github.com/itteco/service_merchant
Rakefile
Ruby
mit
191
master
3,285
require 'rubygems' require 'rake' require 'rake/testtask' require 'rake/rdoctask' require 'rake/gempackagetask' require 'rake/contrib/rubyforgepublisher' PKG_VERSION = "0.1.0" PKG_NAME = "service_merchant" PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" PKG_FILES = FileList[ "recurring_billing/**/*", "subscription_m...