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
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/object/directive_object.rb
Ruby
mit
190
master
1,195
# frozen_string_literal: true module Rails module GraphQL class Type # The introspection object for directives class Object::DirectiveObject < Object self.assigned_to = 'Rails::GraphQL::Directive' self.spec_object = true rename! '__Directive' desc <<~DESC D...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/object/type_object.rb
Ruby
mit
190
master
5,320
# frozen_string_literal: true module Rails module GraphQL class Type # The introspection object for any kind of type class Object::TypeObject < Object # List and not null are not actually types, but they still need to # some how exist for introspection purposes FAKE_TYPES = { ...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/object/enum_value_object.rb
Ruby
mit
190
master
715
# frozen_string_literal: true module Rails module GraphQL class Type # The introspection object for an enum value class Object::EnumValueObject < Object self.spec_object = true rename! '__EnumValue' desc <<~DESC One of the values of an Enum object. It is unique wit...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/object/schema_object.rb
Ruby
mit
190
master
1,254
# frozen_string_literal: true module Rails module GraphQL class Type # The introspection object for a schema object class Object::SchemaObject < Object self.assigned_to = 'Rails::GraphQL::Schema' self.spec_object = true rename! '__Schema' desc <<~DESC A Gra...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/enum/type_kind_enum.rb
Ruby
mit
190
master
1,855
# frozen_string_literal: true module Rails module GraphQL class Type # Bigint basically removes the limit of the value, but it serializes as # a string so it won't go against the spec class Enum::TypeKindEnum < Enum self.spec_object = true rename! '__TypeKind' desc <<~...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/enum/directive_location_enum.rb
Ruby
mit
190
master
954
# frozen_string_literal: true module Rails module GraphQL class Type # Bigint basically removes the limit of the value, but it serializes as # a string so it won't go against the spec class Enum::DirectiveLocationEnum < Enum self.spec_object = true rename! '__DirectiveLocation'...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/decimal_scalar.rb
Ruby
mit
190
master
963
# frozen_string_literal: true module Rails module GraphQL class Type # Similar to float, but implies extra precision, making sure that all the # decimal-point numbers are kept. As Bigint, it uses a string so it won't # go against the spec. class Scalar::DecimalScalar < Scalar desc...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/bigint_scalar.rb
Ruby
mit
190
master
834
# frozen_string_literal: true module Rails module GraphQL class Type # Bigint basically removes the limit of the value, but it serializes as # a string so it won't go against the spec class Scalar::BigintScalar < Scalar desc <<~DESC The Bigint scalar type represents a signed n...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/any_scalar.rb
Ruby
mit
190
master
587
# frozen_string_literal: true module Rails module GraphQL class Type # Handles any type of data for both input and output class Scalar::AnyScalar < Scalar desc 'The Any scalar type allows anything for both input and output.' class << self def valid_input?(value) ...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/id_scalar.rb
Ruby
mit
190
master
1,210
# frozen_string_literal: true module Rails module GraphQL class Type # The ID scalar type represents a unique identifier, often used to # refetch an object or as the key for a cache. The ID type is serialized # in the same way as a +StringScalar+. # # See http://spec.graphql.org/Jun...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/date_time_scalar.rb
Ruby
mit
190
master
796
# frozen_string_literal: true module Rails module GraphQL class Type # DateTime uses a ISO 8601 string to exchange the value. class Scalar::DateTimeScalar < Scalar aliases :datetime desc 'The DateTime scalar type represents a ISO 8601 string value.' use :specified_by, url: '...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/time_scalar.rb
Ruby
mit
190
master
1,215
# frozen_string_literal: true module Rails module GraphQL class Type # Uses as a float extension in order to transmit times (hours, minutes, # and seconds) as a numeric representation of seconds and milliseconds. class Scalar::TimeScalar < Scalar::FloatScalar EPOCH = Time.utc(2000, 1, 1...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/string_scalar.rb
Ruby
mit
190
master
1,163
# frozen_string_literal: true module Rails module GraphQL class Type # The String scalar type represents textual data, represented as UTF-8 # character sequences. # # See http://spec.graphql.org/June2018/#sec-String class Scalar::StringScalar < Scalar self.spec_object = true...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/boolean_scalar.rb
Ruby
mit
190
master
906
# frozen_string_literal: true module Rails module GraphQL class Type # The Boolean scalar type represents +true+ or +false+. # # See http://spec.graphql.org/June2018/#sec-Boolean class Scalar::BooleanScalar < Scalar self.spec_object = true aliases :bool desc 'The ...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/binary_scalar.rb
Ruby
mit
190
master
879
# frozen_string_literal: true module Rails module GraphQL class Type # Binary basically allows binary data to be shared using Base64 strings, # ensuring the UTF-8 encoding and performing the necessary conversion. # # It also rely on ActiveModel so it can easily share the same Data object....
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/date_scalar.rb
Ruby
mit
190
master
836
# frozen_string_literal: true module Rails module GraphQL class Type # Date uses a ISO 8601 string to exchange the value. class Scalar::DateScalar < Scalar desc 'The Date scalar type represents a ISO 8601 string value.' use :specified_by, url: 'https://en.wikipedia.org/wiki/ISO_8601'...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/json_scalar.rb
Ruby
mit
190
master
923
# frozen_string_literal: true module Rails module GraphQL class Type # Handles an unstructured JSON data class Scalar::JsonScalar < Scalar rename! 'JSON' desc <<~DESC The JSON scalar type represents an unstructured JSON data with all its available keys and values....
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/float_scalar.rb
Ruby
mit
190
master
801
# frozen_string_literal: true module Rails module GraphQL class Type # The Float scalar type represents signed double-precision fractional # values as specified by # {IEEE 754}[http://en.wikipedia.org/wiki/IEEE_floating_point]. # # See http://spec.graphql.org/June2018/#sec-Float ...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/rails/graphql/type/scalar/int_scalar.rb
Ruby
mit
190
master
966
# frozen_string_literal: true module Rails module GraphQL class Type # The Int scalar type represents a signed 32-bit numeric # non-fractional value. # # See http://spec.graphql.org/June2018/#sec-Int class Scalar::IntScalar < Scalar self.spec_object = true aliases :i...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/generators/graphql/schema_generator.rb
Ruby
mit
190
master
656
# frozen_string_literal: true require 'rails/generators/base' module GraphQL module Generators class SchemaGenerator < Rails::Generators::Base # :nodoc: include Rails::GraphQL::BaseGenerator desc 'Add a new GraphQL schema' argument :schema, type: :string, optional: true, default: "#{...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/generators/graphql/install_generator.rb
Ruby
mit
190
master
1,389
# frozen_string_literal: true require 'rails/generators/base' module GraphQL module Generators class InstallGenerator < Rails::Generators::Base # :nodoc: include Rails::GraphQL::BaseGenerator desc 'Add an initial setup to your application' argument :schema, type: :string, optional: true, ...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/generators/graphql/channel_generator.rb
Ruby
mit
190
master
673
# frozen_string_literal: true require 'rails/generators/base' module GraphQL module Generators class ChannelGenerator < Rails::Generators::Base # :nodoc: include Rails::GraphQL::BaseGenerator desc 'Add a new action cable channel that operates with GraphQL' argument :name, type: :string, opti...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/generators/graphql/controller_generator.rb
Ruby
mit
190
master
693
# frozen_string_literal: true require 'rails/generators/base' module GraphQL module Generators class ControllerGenerator < Rails::Generators::Base # :nodoc: include Rails::GraphQL::BaseGenerator desc 'Add a new controller that operates with GraphQL' argument :name, type: :string, optional: t...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
lib/generators/graphql/templates/config.rb
Ruby
mit
190
master
4,812
# frozen_string_literal: true Rails::GraphQL.configure do |config| # This helps to keep track of when things were cached and registered. Cached # objects with mismatching versions need to be upgraded or simply reloaded. # An excellent way to use this is to set it to the commit hash. TypePap will # always use o...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
benchmarks/append.rb
Ruby
mit
190
master
476
require 'benchmark/ips' def slow_plus x = 'foo' x += 'bar' end def slow_concat x = 'foo' x.concat 'bar' end def fast_append x = 'foo' x << 'bar' end def fast_interpolation x = 'foo' x = "#{x}bar" end Benchmark.ips do |x| x.report('x += "bar"') { slow_plus } x.report('x.concat("bar")...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
benchmarks/star_wars.rb
Ruby
mit
190
master
1,861
# frozen_string_literal: true require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'benchmark-memory', require: 'benchmark/memory' gem 'benchmark-ips', require: 'benchmark/ips' gem 'pry-byebug' gem 'rails', '>= 5.0' gem 'graphql' gem 'rails-graphql', path: '../' end require 'rails' lo...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
benchmarks/parse.rb
Ruby
mit
190
master
1,944
# frozen_string_literal: true require 'bundler/inline' gemfile do source 'https://rubygems.org' gem 'rails', '>= 5.0' gem 'benchmark-ips', require: 'benchmark/ips' gem 'graphql', require: 'graphql' gem 'rails-graphql', path: '../' end require_relative '../lib/rails/graphql' document = <<-GRAPHQL q...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
benchmarks/json.rb
Ruby
mit
190
master
2,194
# frozen_string_literal: true require 'benchmark/ips' require 'json' # Load Rails Dir.chdir('/var/www/graphql/app') do load 'config/environment.rb' end def generate_hash(iteration = 0) ELEMENTS.times.map do |_| result = { 'firstName' => 'John', 'lastName' => 'Snow', 'age' => 32, } ...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
benchmarks/star_wars/original_gem.rb
Ruby
mit
190
master
2,011
# frozen_string_literal: true module StarWars class EpisodeEnum < GraphQL::Schema::Enum description 'One of the films in the Star Wars Trilogy' value 'NEW_HOPE', 'Released in 1977.' value 'EMPIRE', 'Released in 1980.' value 'JEDI', 'Released in 1983.' end module CharacterInterface inc...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
benchmarks/star_wars/new_gem.rb
Ruby
mit
190
master
2,618
class StarWarsSchema < Rails::GraphQL::Schema enum 'Episode' do desc 'One of the films in the Star Wars Trilogy' add 'NEW_HOPE', desc: 'Released in 1977.' add 'EMPIRE', desc: 'Released in 1980.' add 'JEDI', desc: 'Released in 1983.' end interface 'Character' do desc 'A character in the...
github
virtualshield/rails-graphql
https://github.com/virtualshield/rails-graphql
tasks/libgraphqlparser.rb
Ruby
mit
190
master
329
# frozen_string_literal: true require 'rake/extensiontask' gem_spec = Gem::Specification.load('rails-graphql.gemspec') Rake::ExtensionTask.new(:gql_parser, gem_spec) do |ext| ext.name = 'gql_parser' ext.ext_dir = 'ext' ext.lib_dir = 'lib' ext.cross_compile = true ext.cross_platform = %w[x86-mingw32 x64-ming...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
Gemfile
Ruby
mit
190
main
208
# frozen_string_literal: true source 'https://rubygems.org' gem 'heroku_hatchet' gem 'java-properties' gem 'parallel_split_test' gem 'rspec-expectations' gem 'rspec-retry' gem 'rubocop' gem 'rubocop-rspec'
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/ci_spec.rb
Ruby
mit
190
main
7,185
# frozen_string_literal: true require_relative 'spec_helper' RSpec.describe 'Scala buildpack' do it 'runs tests on Heroku CI' do new_default_hatchet_runner('sbt-1.11.7-play-3.x-scala-2.13.x').tap do |app| app.run_ci do |test_run| # First CI run should build from scratch expect(clean_output...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/sbt_spec.rb
Ruby
mit
190
main
6,538
# frozen_string_literal: true require_relative 'spec_helper' describe 'Sbt' do it 'runs sbt-clean' do new_default_hatchet_runner('sbt-1.11.7-minimal-with-native-packager').tap do |app| app.before_deploy do app.set_config('SBT_CLEAN' => 'true') end app.deploy do expect(app.outp...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/detection_spec.rb
Ruby
mit
190
main
1,763
# frozen_string_literal: true require_relative 'spec_helper' RSpec.describe 'Scala buildpack detection' do it 'shows helpful error message when no sbt project files are found' do app = Hatchet::Runner.new('non-sbt-app', allow_failure: true) app.deploy do expect(clean_output(app.output)).to include(<<~...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/sbt_version_spec.rb
Ruby
mit
190
main
5,637
# frozen_string_literal: true require_relative 'spec_helper' describe 'Sbt version warnings' do it 'shows warning for sbt 0.13.18' do new_default_hatchet_runner('sbt-0.13.18-minimal-with-native-packager').tap do |app| app.deploy do expect(clean_output(app.output)).to include(<<~OUTPUT) r...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/spec_helper.rb
Ruby
mit
190
main
4,546
# frozen_string_literal: true require 'English' require 'rspec/core' require 'rspec/retry' require 'hatchet' require 'java-properties' DEFAULT_OPENJDK_VERSION = '1.8' RSpec.configure do |config| config.fail_if_no_examples = true config.full_backtrace = true # rspec-retry config.verbose_retry = tru...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/config_spec.rb
Ruby
mit
190
main
3,187
# frozen_string_literal: true require_relative 'spec_helper' describe 'Scala buildpack configuration' do it 'supports environment variable configuration without warning' do new_default_hatchet_runner('sbt-1.11.7-minimal-with-native-packager').tap do |app| app.before_deploy do app.set_config('SBT_C...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/cache_spec.rb
Ruby
mit
190
main
99,975
# frozen_string_literal: true require_relative 'spec_helper' describe 'Scala buildpack' do it 'caches compiled artifacts between builds with sbt 1.x' do new_default_hatchet_runner('sbt-1.11.7-play-3.x-scala-2.13.x').tap do |app| app.deploy do # First build should compile everything from scratch ...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/sbt_multi_project_spec.rb
Ruby
mit
190
main
6,204
# frozen_string_literal: true require_relative 'spec_helper' describe 'Sbt multi-project builds' do it 'applies project prefix to all tasks when SBT_PROJECT is set' do new_default_hatchet_runner('sbt-1.11.7-minimal-multi-project-with-native-packager').tap do |app| app.before_deploy do app.set_conf...
github
heroku/heroku-buildpack-scala
https://github.com/heroku/heroku-buildpack-scala
test/spec/sbt_at_runtime_spec.rb
Ruby
mit
190
main
80,220
# frozen_string_literal: true require_relative 'spec_helper' describe 'Scala buildpack' do it 'makes sbt 1.x available at runtime' do new_default_hatchet_runner('sbt-1.11.7-minimal-with-native-packager').tap do |app| app.deploy do sbt_about_output = app.run('sbt about', heroku: { size: 'standard-2...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
enumerated_attribute.gemspec
Ruby
mit
190
master
5,825
# Generated by jeweler # DO NOT EDIT THIS FILE DIRECTLY # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' # -*- encoding: utf-8 -*- Gem::Specification.new do |s| s.name = "enumerated_attribute" s.version = "0.3.0.beta1" s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
Rakefile
Ruby
mit
190
master
2,475
#require 'rake/testtask' require 'rdoc/task' require 'rubygems/package_task' require 'rake/contrib/sshpublisher' require 'jeweler' Jeweler::Tasks.new do |s| s.name = 'enumerated_attribute' s.summary = 'Enumerated model attributes and view helpers' s.description = 'Add enumerated attributes to your models and exp...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute.rb
Ruby
mit
190
master
450
gem 'meta_programming', '>= 0.2.0' require 'meta_programming' require 'enumerated_attribute/attribute' module EnumeratedAttribute module MacroMethods def enumerated_attribute(*args, &block) class << self include EnumeratedAttribute::Attribute end create_enumerated_attribute(*args, &block) end a...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/integrations.rb
Ruby
mit
190
master
1,056
require 'enumerated_attribute/integrations/active_record' require 'enumerated_attribute/integrations/object' require 'enumerated_attribute/integrations/datamapper' require 'enumerated_attribute/integrations/default' module EnumeratedAttribute module Integrations @@integration_map = {} def self.add_integration...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/method_definition_dsl.rb
Ruby
mit
190
master
5,261
module EnumeratedAttribute class MethodDefinition attr_accessor :method_name, :negated, :argument def initialize(name, arg, negated=false) @method_name, @negated, @argument = name, negated, arg end def is_predicate_method?; @method_name[-1, 1] == '?'; end def has_method_name?; ...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/attribute.rb
Ruby
mit
190
master
3,396
require 'enumerated_attribute/attribute/attribute_descriptor' require 'enumerated_attribute/attribute/arguments' require 'enumerated_attribute/attribute/instance_methods' require 'enumerated_attribute/attribute/class_methods' require 'enumerated_attribute/method_definition_dsl' require 'enumerated_attribute/integration...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/rails_helpers.rb
Ruby
mit
190
master
3,472
require 'active_record/connection_adapters/abstract/schema_definitions' if defined?(ActiveRecord) module ActiveRecord module ConnectionAdapters class TableDefinition def column_with_enumerated_attribute(name, type, options = {}) type = 'string' if type.to_s == 'enum' column_without_enumerated_attri...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/integrations/active_record.rb
Ruby
mit
190
master
3,690
module EnumeratedAttribute module Integrations module ActiveRecord def self.included(klass) klass.extend(ClassMethods) klass.validate :validate_enumerated_attribute end def validate_enumerated_attribute attributes.each do |k,v| if self.class.has_enumerated_attribute?(k) and not self.class...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/integrations/object.rb
Ruby
mit
190
master
1,231
module EnumeratedAttribute module Integrations module Object def self.included(klass) klass.extend(ClassMethods) end def write_enumerated_attribute(name, val) name = name.to_s val = nil if val == '' val = val.to_sym if val unless self.class.enumerated_attribute_allows_value?(name, val...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/integrations/default.rb
Ruby
mit
190
master
584
module EnumeratedAttribute module Integrations module Default def self.included(klass); klass.extend(ClassMethods); end module ClassMethods def define_enumerated_attribute_writer_method(name) method_name = "#{name}=".to_sym class_eval do define_method(method_name) {|val| write_enumerate...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/attribute/attribute_descriptor.rb
Ruby
mit
190
master
1,011
module EnumeratedAttribute module Attribute class AttributeDescriptor < Array attr_reader :name attr_accessor :init_value def initialize(name, enums=[], opts={}) super enums @name = name @options = opts @labels_hash = Hash[*self.collect{|e| [e, e.to_s.gsub(/_/, ' ').squeeze(' ').capita...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/attribute/class_methods.rb
Ruby
mit
190
master
1,655
module EnumeratedAttribute module Attribute module ClassMethods def refresh_enumerated_attributes @all_enumerated_attributes_cache = nil end def enumerated_attributes(all=true) return @enumerated_attributes unless all return @all_enumerated_attributes_cache if @all_enumer...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/attribute/instance_methods.rb
Ruby
mit
190
master
3,388
module EnumeratedAttribute module Attribute module InstanceMethods def self.included(base) method_missing_suffix = "enumerated_attribute_#{base.name.gsub(/.+::/,'')}_#{base.hash.abs}".to_sym define_method("method_missing_with_#{method_missing_suffix}") do |methId, *args| return se...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
lib/enumerated_attribute/attribute/arguments.rb
Ruby
mit
190
master
1,862
module EnumeratedAttribute module Attribute module Arguments def self.validate_enum_attr_arguments(config) raise(InvalidDefinition, 'second argument of enumerated_attribute/enum_attr is not an array of symbols or strings representing the enum values', caller) if config.enums.empty? end def se...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/inheritance_spec.rb
Ruby
mit
190
master
2,103
require 'inheritance_classes' def one_to_four; [:one, :two, :three, :four]; end def five_to_eight; [:five, :six, :seven, :eight]; end describe "Base" do it "should have :base1 init to :one" do o=Base.new o.base1.should == :one o.enums(:base1).should == one_to_four o.base1_previous.should == :four end it "s...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/tractor.rb
Ruby
mit
190
master
1,500
require 'enumerated_attribute' class Tractor GEAR_ENUM_VALUES = %w(reverse neutral first second over_drive).map{|v| v.to_sym} LIGHTS_ENUM_VALUES = %w(off low high).map{|v| v.to_sym} SIDE_LIGHT_ENUM_VALUES = [:off,:low,:high,:super_high] attr_accessor :name def initialize @name = 'old faithful' ...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/car.rb
Ruby
mit
190
master
1,460
require 'enumerated_attribute' #used to test that method_missing chaining plays nice in inheritance situations class Vehicle def vehicle_method_missing_called?; @vehicle_method_missing_called; end def self.vehicle_new_called?; @@vehicle_new_called; end def self.reset; @@vehicle_new_called = false; end @@vehi...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/new_and_method_missing_spec.rb
Ruby
mit
190
master
2,288
require 'car' #used to test that method_missing chaining plays nice in inheritance situation describe "CarWithMethods" do it "should initialize Car and Vehicle _method_missing_called? to false" do c= CarWithMethods.new c.car_method_missing_called?.should be_false c.vehicle_method_missing_called?.should be_fa...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/inheritance_classes.rb
Ruby
mit
190
master
371
require 'enumerated_attribute' class Base enum_attr :base1, %w(^one two three four) enum_attr :inherited1, %w(^one two three four) enum_attr :inherited2, %w(^one two three four) end class Sub < Base enum_attr :sub1, %w(one ^two three four) enum_attr :inherited1, %w(one ^two three four) enum_attr :inherited2, %w...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/plural.rb
Ruby
mit
190
master
215
require 'enumerated_attribute' class Plural enum_attr :box, %w(small medium large) enum_attr :batch, %w(none daily weekly) enum_attr :cherry, %w(red green yellow) enum_attr :guy, %w(handsome funny cool) end
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/poro_spec.rb
Ruby
mit
190
master
12,599
require 'rubygems' require 'tractor' require 'plural' RSpec::Matchers.define :define_instance_method do |method_name| match do |klass_or_object| if klass_or_object.is_a?(Class) klass_or_object.method_defined?(method_name.to_sym) else klass_or_object.class.method_defined?(method_name.to_sym) e...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/config/routes.rb
Ruby
mit
190
master
1,920
ActionController::Routing::Routes.draw do |map| # The priority is based upon order of creation: first created -> highest priority. # Sample of regular route: # map.connect 'products/:id', :controller => 'catalog', :action => 'view' # Keep in mind you can assign values other than :controller and :action # ...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/config/environment.rb
Ruby
mit
190
master
2,065
# Be sure to restart your server when you modify this file # Specifies gem version of Rails to use when vendor/rails is not present RAILS_GEM_VERSION = '< 2.4.0' unless defined? RAILS_GEM_VERSION # Bootstrap the Rails environment, frameworks, and default configuration require File.join(File.dirname(__FILE__), 'boot')...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/config/initializers/session_store.rb
Ruby
mit
190
master
798
# Be sure to restart your server when you modify this file. # Your secret key for verifying cookie session data integrity. # If you change this key, all old sessions will become invalid! # Make sure the secret is at least 30 characters and all random, # no regular words or you'll be exposed to dictionary attacks. Act...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/spec/matchers.rb
Ruby
mit
190
master
222
#defines custom rspec matcher for this test RSpec::Matchers.define :be_blank do match do |value| value == nil || value == '' end end RSpec::Matchers.define :be_nil do match do |value| value == nil end end
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/spec/spec_helper.rb
Ruby
mit
190
master
1,101
# This file is copied to ~/spec when you run 'ruby script/generate rspec' # from the project root directory. ENV["RAILS_ENV"] ||= 'test' require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT) #require 'enumerated_attribute' require 'spec/autorun' gem 'rspec-rails', '>= 1.3.2' require 'spe...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/spec/controllers/form_test_controller_spec.rb
Ruby
mit
190
master
811
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') describe FormTestController do #Delete these examples and add some real ones it "should use FormTestController" do controller.should be_an_instance_of(FormTestController) end describe "GET 'form'" do it "should return gender with ma...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/spec/integrations/enum_select_spec.rb
Ruby
mit
190
master
2,483
require File.expand_path(File.join(File.dirname(__FILE__), '../spec_helper.rb')) shared_examples_for "enum_select form" do it "should have select boxes for gender, status and degree initially set blank" do visit form_page select_option('', /gender/) select_option('', /status/) select_option('None', /degree/) ...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/spec/views/form_test/form_tag.html.erb_spec.rb
Ruby
mit
190
master
339
require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper') describe "/dog/bark" do before(:each) do render 'dog/bark' end #Delete this example and add some real ones or delete this file it "should tell you where to find the file" do response.should have_tag('p', %r[Find me in app/views/do...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/db/schema.rb
Ruby
mit
190
master
1,370
# This file is auto-generated from the current state of the database. Instead of editing this file, # please use the migrations feature of Active Record to incrementally modify your database, and # then regenerate this schema definition. # # Note that this schema.rb definition is the authoritative source for your data...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/db/migrate/20090804230221_create_sessions.rb
Ruby
mit
190
master
317
class CreateSessions < ActiveRecord::Migration def self.up create_table :sessions do |t| t.string :session_id, :null => false t.text :data t.timestamps end add_index :sessions, :session_id add_index :sessions, :updated_at end def self.down drop_table :sessions end end
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/db/migrate/20090804230546_create_users.rb
Ruby
mit
190
master
382
class CreateUsers < ActiveRecord::Migration def self.up create_table :users do |t| t.string :first_name t.integer :age t.enum :gender #t.string :gender t.date :DOB t.column :degree, :enum t.enum :status #t.string :degree #t.string :status t.timestamps ...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/app/controllers/form_test_controller.rb
Ruby
mit
190
master
715
class FormTestController < ApplicationController def index end #ActionView::Helpers:ActiveRecordHelper def form @user = User.new(params[:user]) return if request.get? return unless @user.save redirect_to :action=>:index end #ActionView::Helpers::FormHelper def form_for @u...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/rails/app/models/user.rb
Ruby
mit
190
master
326
require 'enumerated_attribute' class User < ActiveRecord::Base validates_presence_of :first_name, :gender, :age, :status, :degree validates_numericality_of :age enum_attr :gender, %w(male female) enum_attr :status, %w(single married divorced widowed) enum_attr :degree, %w(^none high_school college graduate...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/inheritance_classes.rb
Ruby
mit
190
master
333
require 'active_record/race_car' class SubRaceCar < RaceCar set_table_name "race_cars" enum_attr :extra, %w(^one two three four) end class SubRaceCar2 < RaceCar set_table_name "race_cars" end class SubRaceCar3 < RaceCar set_table_name "race_cars" enum_attr :gear, %w(reverse neutral ^first second third over...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/cfg.rb
Ruby
mit
190
master
215
#irb -r cfg ==> to work configure for working in IRB $:.unshift '../../lib' require 'active_record/test_in_memory' require 'enumerated_attribute' require 'active_record/race_car' require 'active_record/sti_classes'
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/test_in_memory.rb
Ruby
mit
190
master
1,773
require 'rubygems' gem 'activerecord', ENV['AR_VERSION'] ? "=#{ENV['AR_VERSION']}" : '>=2.1.0' require 'active_record' require 'active_support/core_ext/logger' rescue nil # rails3 require 'enumerated_attribute' ActiveRecord::Base.establish_connection({'adapter' => 'sqlite3', 'database' => ':memory:'}) ActiveRecord:...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/inheritance_spec.rb
Ruby
mit
190
master
1,620
require 'active_record/test_in_memory' require 'enumerated_attribute' require 'active_record' require 'active_record/inheritance_classes' def one_to_four; [:one, :two, :three, :four]; end def gear1; [:reverse, :neutral, :first, :second, :over_drive]; end def gear2; [:reverse, :neutral, :first, :second, :third, :over_d...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/race_car.rb
Ruby
mit
190
master
327
class RaceCar < ActiveRecord::Base enum_attr :gear, %w(reverse ^neutral first second over_drive) enum_attr :choke, %w(^none medium full) end #gear = enumerated column attribute #choke = enumerated non-column attribute #lights = non-enumerated column attribute =begin t.string :name t.string :gear t.string :lights...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/sti_spec.rb
Ruby
mit
190
master
1,100
require 'active_record/test_in_memory' require 'enumerated_attribute' require 'active_record' require 'active_record/sti_classes' #contributed by Rob Chekaluk describe "enum_attr for STI subclass" do it "should assign, save and retrieve non-enumerated attribute" do s = StiSub.new() s.sub_nonenum = "value2" ...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/df.rb
Ruby
mit
190
master
271
require 'cfg' r=RaceCar.new r.gear = :second r.name = 'special' r.save! #RaceCar.find_by_gear_and_name(:second, 'special') car = RaceCar.find_or_create_by_name_and_gear('special', :second) debugger car0 = RaceCar.find_or_create_by_name_and_gear('special', :second) car0
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/associations_spec.rb
Ruby
mit
190
master
3,885
require 'active_record/test_in_memory' require 'enumerated_attribute' require 'active_record' require 'active_record/association_test_classes' module TestVariables def company_name; 'Company A'; end end describe "Polymorphic associations" do include TestVariables it "should retrieve enum'ed attribute for article...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/active_record_spec.rb
Ruby
mit
190
master
11,371
require 'active_record/test_in_memory' require 'active_record' require 'enumerated_attribute' require 'active_record/race_car' describe "RaceCar" do it "should have default labels for :gear attribute" do labels_hash = {:reverse=>'Reverse', :neutral=>'Neutral', :first=>'First', :second=>'Second', :over_drive=>'Over...
github
jeffp/enumerated_attribute
https://github.com/jeffp/enumerated_attribute
spec/active_record/association_test_classes.rb
Ruby
mit
190
master
1,146
class Company < ActiveRecord::Base has_one :license has_many :employees has_many :contract_workers has_many :contractors, :through=>:contract_workers enum_attr :status, %w(s_corp c_corp llc), :nil=>true end class Employee < ActiveRecord::Base belongs_to :company enum_attr :status, %w(full_time part_time suspend...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
procsd.gemspec
Ruby
mit
190
master
1,323
lib = File.expand_path("../lib", __FILE__) $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) require "procsd/version" Gem::Specification.new do |spec| spec.name = "procsd" spec.version = Procsd::VERSION spec.authors = ["Victor Afanasev"] spec.email = ["vicfreefly@gmail.com"] ...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
Gemfile
Ruby
mit
190
master
228
source "https://rubygems.org" git_source(:github) {|repo_name| "https://github.com/#{repo_name}" } # Specify your gem's dependencies in procsd.gemspec gemspec # Required for Ruby 4.0+ (removed from default gems) gem "logger"
github
vifreefly/procsd
https://github.com/vifreefly/procsd
Rakefile
Ruby
mit
190
master
521
require "bundler/gem_tasks" require "rspec/core/rake_task" require "cucumber/rake/task" RSpec::Core::RakeTask.new(:spec) Cucumber::Rake::Task.new(:cucumber) do |t| t.cucumber_opts = ["--format", "progress"] end task :clear_coverage do rm_rf "coverage" end task :coverage_report do require "simplecov" SimpleC...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
features/step_definitions/procsd_steps.rb
Ruby
mit
190
master
3,118
Given("a procsd.yml with:") do |content| @container.write_file("/home/testuser/myapp/procsd.yml", content) end Given("a Procfile with:") do |content| @container.write_file("/home/testuser/myapp/Procfile", content) end When("I wait {int} seconds") do |seconds| sleep(seconds) end When("I run {string}") do |comma...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
features/support/container_helper.rb
Ruby
mit
190
master
5,655
require "open3" require "securerandom" require "fileutils" require "json" module ContainerHelper DOCKERFILE_PATH = File.expand_path("Dockerfile", __dir__) IMAGE_NAME = "procsd-test" GEM_ROOT = File.expand_path("../..", __dir__) COVERAGE_DIR = File.join(GEM_ROOT, "coverage") CONTAINER_COVERAGE_DIR = "/tmp/cov...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
spec/generator_spec.rb
Ruby
mit
190
master
9,937
require "procsd/generator" require "tmpdir" RSpec.describe Procsd::Generator do let(:basic_config) do { app: "myapp", systemd_dir: "/etc/systemd/system", environment: { "PORT" => "3000", "RAILS_ENV" => "production" }, processes: { "web" => { "comman...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
spec/spec_helper.rb
Ruby
mit
190
master
592
require "simplecov" SimpleCov.command_name "unit" $LOAD_PATH.unshift File.expand_path("../../lib", __FILE__) require "procsd" RSpec.configure do |config| config.expect_with :rspec do |expectations| expectations.include_chain_clauses_in_custom_matcher_descriptions = true end config.mock_with :rspec do |mock...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
spec/config_spec.rb
Ruby
mit
190
master
8,390
require "spec_helper" require "procsd/config" require "tmpdir" RSpec.describe Procsd::Config do around do |example| Dir.mktmpdir do |tmpdir| Dir.chdir(tmpdir) { example.run } end end describe ".load" do it "loads a basic procsd.yml" do File.write("procsd.yml", <<~YAML) app: myapp...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
lib/procsd.rb
Ruby
mit
190
master
222
require 'dotenv/load' require 'thor' require 'erb' require 'procsd/version' module Procsd DEFAULT_SYSTEMD_DIR = "/etc/systemd/system".freeze SUDOERS_DIR = "/etc/sudoers.d".freeze NGINX_DIR = "/etc/nginx".freeze end
github
vifreefly/procsd
https://github.com/vifreefly/procsd
lib/procsd/generator.rb
Ruby
mit
190
master
3,835
require 'pathname' module Procsd class Generator attr_reader :app_name, :target_name def initialize(config, options) @config = config @options = options @app_name = @config[:app] @target_name = "#{app_name}.target" end def generate_units(save: false) services = {} ...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
lib/procsd/config.rb
Ruby
mit
190
master
2,089
require "yaml" require "erb" module Procsd class Config < Struct.new(:app, :processes, :environment, :dev_environment, :systemd_dir, :nginx) class Error < StandardError; end def self.load(path = "procsd.yml") new(path) end def initialize(path) config_file = read_config_file(path) ...
github
vifreefly/procsd
https://github.com/vifreefly/procsd
lib/procsd/cli.rb
Ruby
mit
190
master
14,061
require_relative 'config' require_relative 'generator' module Procsd class CLI < Thor class ConfigurationError < StandardError; end class ArgumentError < StandardError; end desc "create", "Create and enable app services" option :user, aliases: :u, type: :string, banner: "$USER", default: ENV["USER"]...
github
biola/Voight-Kampff
https://github.com/biola/Voight-Kampff
voight_kampff.gemspec
Ruby
mit
190
master
990
# -*- encoding: utf-8 -*- $:.unshift File.expand_path('../lib', __FILE__) require 'voight_kampff/version' Gem::Specification.new do |s| s.name = 'voight_kampff' s.summary = "Voight-Kampff bot detection" s.description = 'Voight-Kampff detects bots, spiders, crawlers and replicants' s.licenses = ['MIT'...
github
biola/Voight-Kampff
https://github.com/biola/Voight-Kampff
lib/voight_kampff.rb
Ruby
mit
190
master
521
require 'json' require 'voight_kampff/test' require 'voight_kampff/methods' module VoightKampff class << self def root require 'pathname' Pathname.new File.expand_path '..', File.dirname(__FILE__) end def human?(user_agent_string) test(user_agent_string).human? end def bot?(u...
github
biola/Voight-Kampff
https://github.com/biola/Voight-Kampff
lib/tasks/voight_kampff.rake
Ruby
mit
190
master
594
namespace :voight_kampff do desc 'Import a new crawler-user-agents.json file' task :import_user_agents, :url do |t, args| args.with_defaults url: 'https://raw.githubusercontent.com/monperrus/crawler-user-agents/master/crawler-user-agents.json' require 'net/http' uri = URI(args[:url]) contents = Ne...