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 |
|---|---|---|---|---|---|---|---|---|
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/deep_find_spec.rb | spec/hashie/extensions/deep_find_spec.rb | require 'spec_helper'
describe Hashie::Extensions::DeepFind do
subject { Class.new(Hash) { include Hashie::Extensions::DeepFind } }
let(:hash) do
{
library: {
books: [
{ title: 'Call of the Wild' },
{ title: 'Moby Dick' }
],
shelves: nil,
location: {
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/stringify_keys_spec.rb | spec/hashie/extensions/stringify_keys_spec.rb | require 'spec_helper'
require 'support/module_context'
def invoke(method)
if subject == object
subject.public_send(method)
else
subject.public_send(method, object)
end
end
shared_examples 'stringify_keys!' do
it 'converts keys to strings' do
object[:abc] = 'abc'
object[123] = '123'
invoke ... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/ignore_undeclared_spec.rb | spec/hashie/extensions/ignore_undeclared_spec.rb | require 'spec_helper'
describe Hashie::Extensions::IgnoreUndeclared do
context 'included in Trash' do
class ForgivingTrash < Hashie::Trash
include Hashie::Extensions::IgnoreUndeclared
property :city
property :state, from: :province
property :str_state, from: 'str_provence'
end
su... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/autoload_spec.rb | spec/hashie/extensions/autoload_spec.rb | require 'spec_helper'
require 'hashie'
describe Hashie::Extensions do
describe 'autloads constants' do
it { is_expected.to be_const_defined(:MethodAccess) }
it { is_expected.to be_const_defined(:Coercion) }
it { is_expected.to be_const_defined(:DeepMerge) }
it { is_expected.to be_const_defined(:Ignor... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/deep_fetch_spec.rb | spec/hashie/extensions/deep_fetch_spec.rb | require 'spec_helper'
module Hashie
module Extensions
describe DeepFetch do
subject { Class.new(Hash) { include Hashie::Extensions::DeepFetch } }
let(:hash) do
{
library: {
books: [
{ title: 'Call of the Wild' },
{ title: 'Moby Dick' }
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/deep_merge_spec.rb | spec/hashie/extensions/deep_merge_spec.rb | require 'spec_helper'
describe Hashie::Extensions::DeepMerge do
class DeepMergeHash < Hash
include Hashie::Extensions::DeepMerge
end
subject { DeepMergeHash }
it 'should return initial hash for arguments that are not hash' do
hash = subject.new.merge(a: 'a')
expect(hash.deep_merge('abc')).to eq(h... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/coercion_spec.rb | spec/hashie/extensions/coercion_spec.rb | require 'spec_helper'
describe Hashie::Extensions::Coercion do
class NotInitializable
private_class_method :new
end
class Initializable
attr_reader :coerced, :value
def initialize(obj, coerced = nil)
@coerced = coerced
@value = obj.class.to_s
end
def coerced?
!@coerced.ni... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/symbolize_keys_spec.rb | spec/hashie/extensions/symbolize_keys_spec.rb | require 'spec_helper'
require 'support/module_context'
def invoke(method)
if subject == object
subject.public_send(method)
else
subject.public_send(method, object)
end
end
shared_examples 'symbolize_keys!' do
it 'converts keys to symbols' do
object['abc'] = 'abc'
object['def'] = 'def'
invo... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/indifferent_access_spec.rb | spec/hashie/extensions/indifferent_access_spec.rb | require 'spec_helper'
describe Hashie::Extensions::IndifferentAccess do
class IndifferentHashWithMergeInitializer < Hash
include Hashie::Extensions::MergeInitializer
include Hashie::Extensions::IndifferentAccess
class << self
alias build new
end
end
class IndifferentHashWithArrayInitializ... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/merge_initializer_spec.rb | spec/hashie/extensions/merge_initializer_spec.rb | require 'spec_helper'
describe Hashie::Extensions::MergeInitializer do
class MergeInitializerHash < Hash
include Hashie::Extensions::MergeInitializer
end
subject { MergeInitializerHash }
it 'initializes with no arguments' do
expect(subject.new).to eq({})
end
it 'initializes with a hash' do
e... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/indifferent_access_with_rails_hwia_spec.rb | spec/hashie/extensions/indifferent_access_with_rails_hwia_spec.rb | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false | |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/mash/safe_assignment_spec.rb | spec/hashie/extensions/mash/safe_assignment_spec.rb | require 'spec_helper'
describe Hashie::Extensions::Mash::SafeAssignment do
class MashWithSafeAssignment < Hashie::Mash
include Hashie::Extensions::Mash::SafeAssignment
private
def my_own_private
:hello!
end
end
context 'when included in Mash' do
subject { MashWithSafeAssignment.new }... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/mash/keep_original_keys_spec.rb | spec/hashie/extensions/mash/keep_original_keys_spec.rb | require 'spec_helper'
RSpec.describe Hashie::Extensions::Mash::KeepOriginalKeys do
let(:keeping_mash) do
Class.new(Hashie::Mash) do
include Hashie::Extensions::Mash::KeepOriginalKeys
end
end
it 'keeps the keys in the resulting hash identical to the original' do
original = { :a => 'apple', 'b' ... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/mash/define_accessors_spec.rb | spec/hashie/extensions/mash/define_accessors_spec.rb | require 'spec_helper'
describe Hashie::Extensions::Mash::DefineAccessors do
let(:args) { [] }
shared_examples 'class with dynamically defined accessors' do
it 'defines reader on demand' do
expect(subject.method_defined?(:foo)).to be_falsey
instance.foo
expect(subject.method_defined?(:foo)).t... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/mash/permissive_respond_to_spec.rb | spec/hashie/extensions/mash/permissive_respond_to_spec.rb | require 'spec_helper'
RSpec.describe Hashie::Extensions::Mash::PermissiveRespondTo do
class PermissiveMash < Hashie::Mash
include Hashie::Extensions::Mash::PermissiveRespondTo
end
it 'allows you to bind to unset getters' do
mash = PermissiveMash.new(a: 1)
other_mash = PermissiveMash.new(b: 2)
e... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/mash/symbolize_keys_spec.rb | spec/hashie/extensions/mash/symbolize_keys_spec.rb | require 'spec_helper'
RSpec.describe Hashie::Extensions::Mash::SymbolizeKeys do
it 'raises an error when included in a class that is not a Mash' do
expect do
Class.new do
include Hashie::Extensions::Mash::SymbolizeKeys
end
end.to raise_error(ArgumentError)
end
context 'when included ... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/dash/coercion_spec.rb | spec/hashie/extensions/dash/coercion_spec.rb | require 'spec_helper'
describe Hashie::Extensions::Dash::Coercion do
class DashWithCoercion < Hashie::Dash
include Hashie::Extensions::Dash::Coercion
property :type, coerce: Symbol
end
it 'does the coercion of properties' do
expect(DashWithCoercion.new(type: 'something')).to eq(type: :something)
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/dash/indifferent_access_spec.rb | spec/hashie/extensions/dash/indifferent_access_spec.rb | require 'spec_helper'
describe Hashie::Extensions::Dash::IndifferentAccess do
class TrashWithIndifferentAccess < Hashie::Trash
include Hashie::Extensions::Dash::IndifferentAccess
property :per_page, transform_with: ->(v) { v.to_i }
property :total, from: :total_pages
end
class DashWithIndifferentAcc... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/extensions/dash/predefined_values_spec.rb | spec/hashie/extensions/dash/predefined_values_spec.rb | require 'spec_helper'
describe Hashie::Extensions::Dash::PredefinedValues do
let(:extended_dash) do
Class.new(Hashie::Dash) do
include Hashie::Extensions::Dash::PredefinedValues
property :gender, values: %i[male female prefer_not_to_say]
property :age, values: (0..150)
end
end
it 'all... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/spec/hashie/parsers/yaml_erb_parser_spec.rb | spec/hashie/parsers/yaml_erb_parser_spec.rb | require 'spec_helper'
describe Hashie::Extensions::Parsers::YamlErbParser do
describe '.perform' do
context 'a file' do
let(:config) do
<<-CONFIG
---
foo: verbatim
bar: <%= "erb" %>
baz: "<%= __FILE__ %>"
CONFIG
end
let(:path) { 'template.yml' }
subject { described_class.... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie.rb | lib/hashie.rb | require 'hashie/logger'
require 'hashie/version'
module Hashie
autoload :Clash, 'hashie/clash'
autoload :Dash, 'hashie/dash'
autoload :Hash, 'hashie/hash'
autoload :Mash, 'hashie/mash'
autoload :Trash, 'hashie/trash'
autoload :Rash, ... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/version.rb | lib/hashie/version.rb | module Hashie
VERSION = '5.1.1'.freeze
end
| ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/dash.rb | lib/hashie/dash.rb | require 'hashie/hash'
require 'set'
module Hashie
# A Dash is a 'defined' or 'discrete' Hash, that is, a Hash
# that has a set of defined keys that are accessible (with
# optional defaults) and only those keys may be set or read.
#
# Dashes are useful when you need to create a very simple
# lightweight dat... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/logger.rb | lib/hashie/logger.rb | require 'logger'
module Hashie
# The logger that Hashie uses for reporting errors.
#
# @return [Logger]
def self.logger
@logger ||= Logger.new(STDOUT)
end
# Sets the logger that Hashie uses for reporting errors.
#
# @param logger [Logger] The logger to set as Hashie's logger.
# @return [void]
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/array.rb | lib/hashie/array.rb | require 'hashie/extensions/array/pretty_inspect'
require 'hashie/extensions/ruby_version_check'
module Hashie
class Array < ::Array
include Hashie::Extensions::Array::PrettyInspect
include Hashie::Extensions::RubyVersionCheck
with_minimum_ruby('2.3.0') do
def dig(*indexes)
converted_indexes... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/utils.rb | lib/hashie/utils.rb | module Hashie
# A collection of helper methods that can be used throughout the gem.
module Utils
# Describes a method by where it was defined.
#
# @param bound_method [Method] The method to describe.
# @return [String]
def self.method_information(bound_method)
if bound_method.source_locati... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/railtie.rb | lib/hashie/railtie.rb | begin
require 'rails/railtie'
module Hashie
class Railtie < Rails::Railtie
# Set the Hashie.logger to use Rails.logger when used with rails.
initializer 'hashie.configure_logger', after: 'initialize_logger' do
Hashie.logger = Rails.logger
end
initializer 'hashie.patch_hash_exce... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/trash.rb | lib/hashie/trash.rb | require 'hashie/dash'
require 'hashie/extensions/dash/property_translation'
module Hashie
# A Trash is a 'translated' Dash where the keys can be remapped from a source
# hash.
#
# Trashes are useful when you need to read data from another application,
# such as a Java api, where the keys are named differentl... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/clash.rb | lib/hashie/clash.rb | require 'hashie/hash'
module Hashie
#
# A Clash is a "Chainable Lazy Hash". Inspired by libraries such as Arel,
# a Clash allows you to chain together method arguments to build a
# hash, something that's especially useful if you're doing something
# like constructing a complex options hash. Here's a basic ex... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/hash.rb | lib/hashie/hash.rb | require 'hashie/extensions/stringify_keys'
require 'hashie/extensions/pretty_inspect'
module Hashie
# A Hashie Hash is simply a Hash that has convenience
# functions baked in such as stringify_keys that may
# not be available in all libraries.
class Hash < ::Hash
include Hashie::Extensions::PrettyInspect
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/rash.rb | lib/hashie/rash.rb | module Hashie
#
# Rash is a Hash whose keys can be Regexps, or Ranges, which will
# match many input keys.
#
# A good use case for this class is routing URLs in a web framework.
# The Rash's keys match URL patterns, and the values specify actions
# which can handle the URL. When the Rash's value is proc, ... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/mash.rb | lib/hashie/mash.rb | require 'hashie/hash'
require 'hashie/array'
require 'hashie/utils'
require 'hashie/logger'
require 'hashie/extensions/key_conflict_warning'
module Hashie
# Mash allows you to create pseudo-objects that have method-like
# accessors for hash keys. This is useful for such implementations
# as an API-accessing libr... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/method_access.rb | lib/hashie/extensions/method_access.rb | module Hashie
module Extensions
# MethodReader allows you to access keys of the hash
# via method calls. This gives you an OStruct like way
# to access your hash's keys. It will recognize keys
# either as strings or symbols.
#
# Note that while nil keys will be returned as nil,
# undefined... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/pretty_inspect.rb | lib/hashie/extensions/pretty_inspect.rb | module Hashie
module Extensions
module PrettyInspect
def self.included(base)
base.send :alias_method, :hash_inspect, :inspect
base.send :alias_method, :inspect, :hashie_inspect
end
def hashie_inspect
ret = "#<#{self.class}"
keys.sort_by(&:to_s).each do |key|
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/strict_key_access.rb | lib/hashie/extensions/strict_key_access.rb | module Hashie
module Extensions
# SRP: This extension will fail an error whenever a key is accessed
# that does not exist in the hash.
#
# EXAMPLE:
#
# class StrictKeyAccessHash < Hash
# include Hashie::Extensions::StrictKeyAccess
# end
#
# >> hash = Stric... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/deep_fetch.rb | lib/hashie/extensions/deep_fetch.rb | module Hashie
module Extensions
# Searches a deeply nested datastructure for a key path, and returns the associated value.
#
# options = { user: { location: { address: '123 Street' } } }
# options.deep_fetch :user, :location, :address #=> '123 Street'
#
# If a block is provided its value wil... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/merge_initializer.rb | lib/hashie/extensions/merge_initializer.rb | module Hashie
module Extensions
# The MergeInitializer is a super-simple mixin that allows
# you to initialize a subclass of Hash with another Hash
# to give you faster startup time for Hash subclasses. Note
# that you can still provide a default value as a second
# argument to the initializer.
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/symbolize_keys.rb | lib/hashie/extensions/symbolize_keys.rb | module Hashie
module Extensions
module SymbolizeKeys
# Convert all keys in the hash to symbols.
#
# @example
# test = {'abc' => 'def'}
# test.symbolize_keys!
# test # => {:abc => 'def'}
def symbolize_keys!
SymbolizeKeys.symbolize_keys!(self)
self
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/indifferent_access.rb | lib/hashie/extensions/indifferent_access.rb | module Hashie
module Extensions
# IndifferentAccess gives you the ability to not care
# whether your hash has string or symbol keys. Made famous
# in Rails for accessing query and POST parameters, this
# is a handy tool for making sure your hash has maximum
# utility.
#
# One unique featur... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/ignore_undeclared.rb | lib/hashie/extensions/ignore_undeclared.rb | module Hashie
module Extensions
# IgnoreUndeclared is a simple mixin that silently ignores
# undeclared properties on initialization instead of
# raising an error. This is useful when using a Trash to
# capture a subset of a larger hash.
#
# Note that attempting to retrieve or set an undeclare... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/deep_merge.rb | lib/hashie/extensions/deep_merge.rb | module Hashie
module Extensions
module DeepMerge
# Returns a new hash with +self+ and +other_hash+ merged recursively.
def deep_merge(other_hash, &block)
copy = _deep_dup(self)
copy.extend(Hashie::Extensions::DeepMerge) unless copy.respond_to?(:deep_merge!)
copy.deep_merge!(oth... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/key_conversion.rb | lib/hashie/extensions/key_conversion.rb | module Hashie
module Extensions
module KeyConversion
def self.included(base)
base.send :include, SymbolizeKeys
base.send :include, StringifyKeys
end
end
end
end
| ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/deep_find.rb | lib/hashie/extensions/deep_find.rb | require 'hashie/extensions/deep_locate'
module Hashie
module Extensions
module DeepFind
# Performs a depth-first search on deeply nested data structures for
# a key and returns the first occurrence of the key.
#
# options = {user: {location: {address: '123 Street'}}}
# options.exte... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/ruby_version_check.rb | lib/hashie/extensions/ruby_version_check.rb | require 'hashie/extensions/ruby_version'
module Hashie
module Extensions
module RubyVersionCheck
def self.included(base)
base.extend ClassMethods
end
module ClassMethods
def with_minimum_ruby(version)
yield if with_minimum_ruby?(version)
end
def with_... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/ruby_version.rb | lib/hashie/extensions/ruby_version.rb | # Copyright (c) Chad Fowler, Rich Kilmer, Jim Weirich and others.
# Portions copyright (c) Engine Yard and Andre Arko
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# 'Software'), to deal in the Software without restriction, in... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/key_conflict_warning.rb | lib/hashie/extensions/key_conflict_warning.rb | module Hashie
module Extensions
module KeyConflictWarning
class CannotDisableMashWarnings < StandardError
def initialize
super(
'You cannot disable warnings on the base Mash class. ' \
'Please subclass the Mash and disable it in the subclass.'
)
en... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/coercion.rb | lib/hashie/extensions/coercion.rb | module Hashie
class CoercionError < StandardError
def initialize(key, value, into, message)
super("Cannot coerce property #{key.inspect} from #{value.class} to #{into}: #{message}")
end
end
module Extensions
module Coercion
CORE_TYPES = {
Integer => :to_i,
Float =>... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/deep_locate.rb | lib/hashie/extensions/deep_locate.rb | module Hashie
module Extensions
module DeepLocate
# The module level implementation of #deep_locate, in case you do not want
# to include/extend the base datastructure. For further examples please
# see #deep_locate.
#
# @example
# books = [
# {
# title:... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/stringify_keys.rb | lib/hashie/extensions/stringify_keys.rb | module Hashie
module Extensions
module StringifyKeys
# Convert all keys in the hash to strings.
#
# @example
# test = {:abc => 'def'}
# test.stringify_keys!
# test # => {'abc' => 'def'}
def stringify_keys!
StringifyKeys.stringify_keys!(self)
self
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/active_support/core_ext/hash.rb | lib/hashie/extensions/active_support/core_ext/hash.rb | module Hashie
module Extensions
module ActiveSupport
module CoreExt
module Hash
def except(*keys)
string_keys = keys.map { |key| convert_key(key) }
super(*string_keys)
end
end
end
end
end
end
| ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/array/pretty_inspect.rb | lib/hashie/extensions/array/pretty_inspect.rb | module Hashie
module Extensions
module Array
module PrettyInspect
def self.included(base)
base.send :alias_method, :array_inspect, :inspect
base.send :alias_method, :inspect, :hashie_inspect
end
def hashie_inspect
ret = "#<#{self.class} ["
ret... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/mash/symbolize_keys.rb | lib/hashie/extensions/mash/symbolize_keys.rb | module Hashie
module Extensions
module Mash
# Overrides Mash's default behavior of converting keys to strings
#
# @example
# class LazyResponse < Hashie::Mash
# include Hashie::Extensions::Mash::SymbolizeKeys
# end
#
# response = LazyResponse.new("id" => 1... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/mash/safe_assignment.rb | lib/hashie/extensions/mash/safe_assignment.rb | module Hashie
module Extensions
module Mash
module SafeAssignment
def custom_writer(key, *args) #:nodoc:
if !key?(key) && respond_to?(key, true)
raise ArgumentError, "The property #{key} clashes with an existing method."
end
super
end
def []... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/mash/define_accessors.rb | lib/hashie/extensions/mash/define_accessors.rb | module Hashie
module Extensions
module Mash
module DefineAccessors
def self.included(klass)
klass.class_eval do
mod = Ext.new
include mod
end
end
def self.extended(obj)
included(obj.singleton_class)
end
class Ext... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/mash/keep_original_keys.rb | lib/hashie/extensions/mash/keep_original_keys.rb | module Hashie
module Extensions
module Mash
# Overrides the indifferent access of a Mash to keep keys in the
# original format given to the Mash.
#
# @example
# class KeepingMash < Hashie::Mash
# include Hashie::Extensions::Mash::KeepOriginalKeys
# end
#
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/mash/permissive_respond_to.rb | lib/hashie/extensions/mash/permissive_respond_to.rb | module Hashie
module Extensions
module Mash
# Allow a Mash to properly respond to everything
#
# By default, Mashes only say they respond to methods for keys that exist
# in their key set or any of the affix methods (e.g. setter, underbang,
# etc.). This causes issues when you try to... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/dash/predefined_values.rb | lib/hashie/extensions/dash/predefined_values.rb | module Hashie
module Extensions
module Dash
# Extends a Dash with the ability to accept only predefined values on a property.
#
# == Example
#
# class PersonHash < Hashie::Dash
# include Hashie::Extensions::Dash::PredefinedValues
#
# property :gender, valu... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/dash/property_translation.rb | lib/hashie/extensions/dash/property_translation.rb | module Hashie
module Extensions
module Dash
# Extends a Dash with the ability to remap keys from a source hash.
#
# Property translation is useful when you need to read data from another
# application -- such as a Java API -- where the keys are named
# differently from Ruby conventio... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/dash/indifferent_access.rb | lib/hashie/extensions/dash/indifferent_access.rb | module Hashie
module Extensions
module Dash
module IndifferentAccess
def self.included(base)
base.extend ClassMethods
base.send :include, Hashie::Extensions::IndifferentAccess
end
def self.maybe_extend(base)
return unless requires_class_methods?(base)
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/dash/coercion.rb | lib/hashie/extensions/dash/coercion.rb | module Hashie
module Extensions
module Dash
module Coercion
# Extends a Dash with the ability to define coercion for properties.
def self.included(base)
base.send :include, Hashie::Extensions::Coercion
base.extend ClassMethods
end
module ClassMethods
... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
hashie/hashie | https://github.com/hashie/hashie/blob/2be306fd903bce762cda8e25feb07f172099ef11/lib/hashie/extensions/parsers/yaml_erb_parser.rb | lib/hashie/extensions/parsers/yaml_erb_parser.rb | require 'yaml'
require 'erb'
require 'pathname'
module Hashie
module Extensions
module Parsers
class YamlErbParser
def initialize(file_path, options = {})
@content = File.read(file_path)
@file_path = file_path.is_a?(Pathname) ? file_path.to_s : file_path
@options = opt... | ruby | MIT | 2be306fd903bce762cda8e25feb07f172099ef11 | 2026-01-04T15:51:50.326133Z | false |
nomad-cli/houston | https://github.com/nomad-cli/houston/blob/2455d5dc3c80c49b47a24a50386bf585dff3e83a/spec/client_spec.rb | spec/client_spec.rb | require 'spec_helper'
describe Houston::Client do
subject { Houston::Client.development }
before(:each) do
stub_const('Houston::Connection', MockConnection)
end
context '#development' do
subject { Houston::Client.development }
describe '#gateway_uri' do
subject { super().gateway_uri }
... | ruby | MIT | 2455d5dc3c80c49b47a24a50386bf585dff3e83a | 2026-01-04T15:51:56.141261Z | false |
nomad-cli/houston | https://github.com/nomad-cli/houston/blob/2455d5dc3c80c49b47a24a50386bf585dff3e83a/spec/notification_spec.rb | spec/notification_spec.rb | require 'spec_helper'
describe Houston::Notification do
let(:notification_options) do
{
token: '<ce8be627 2e43e855 16033e24 b4c28922 0eeda487 9c477160 b2545e95 b68b5969>',
alert: 'Houston, we have a problem.',
badge: 2701,
sound: 'sosumi.aiff',
category: 'INVITE_CATEGORY',
exp... | ruby | MIT | 2455d5dc3c80c49b47a24a50386bf585dff3e83a | 2026-01-04T15:51:56.141261Z | false |
nomad-cli/houston | https://github.com/nomad-cli/houston/blob/2455d5dc3c80c49b47a24a50386bf585dff3e83a/spec/spec_helper.rb | spec/spec_helper.rb | unless ENV['CI']
require 'simplecov'
SimpleCov.start do
add_filter '/spec/'
end
end
require 'houston'
require 'rspec'
class MockConnection
class << self
def open(_uri, _certificate, _passphrase)
yield new
end
end
def initialize
@unregistered_devices = [
[443779200, 32, 'ce8be... | ruby | MIT | 2455d5dc3c80c49b47a24a50386bf585dff3e83a | 2026-01-04T15:51:56.141261Z | false |
nomad-cli/houston | https://github.com/nomad-cli/houston/blob/2455d5dc3c80c49b47a24a50386bf585dff3e83a/lib/houston.rb | lib/houston.rb | require 'houston/version'
require 'houston/client'
require 'houston/notification'
require 'houston/connection'
| ruby | MIT | 2455d5dc3c80c49b47a24a50386bf585dff3e83a | 2026-01-04T15:51:56.141261Z | false |
nomad-cli/houston | https://github.com/nomad-cli/houston/blob/2455d5dc3c80c49b47a24a50386bf585dff3e83a/lib/houston/version.rb | lib/houston/version.rb | module Houston
VERSION = '2.4.0'
end
| ruby | MIT | 2455d5dc3c80c49b47a24a50386bf585dff3e83a | 2026-01-04T15:51:56.141261Z | false |
nomad-cli/houston | https://github.com/nomad-cli/houston/blob/2455d5dc3c80c49b47a24a50386bf585dff3e83a/lib/houston/connection.rb | lib/houston/connection.rb | require 'uri'
require 'socket'
require 'openssl'
require 'forwardable'
module Houston
class Connection
extend Forwardable
def_delegators :@ssl, :read, :write
def_delegators :@uri, :scheme, :host, :port
attr_reader :ssl, :socket, :certificate, :passphrase
class << self
def open(uri, certif... | ruby | MIT | 2455d5dc3c80c49b47a24a50386bf585dff3e83a | 2026-01-04T15:51:56.141261Z | false |
nomad-cli/houston | https://github.com/nomad-cli/houston/blob/2455d5dc3c80c49b47a24a50386bf585dff3e83a/lib/houston/client.rb | lib/houston/client.rb | module Houston
APPLE_PRODUCTION_GATEWAY_URI = 'apn://gateway.push.apple.com:2195'
APPLE_PRODUCTION_FEEDBACK_URI = 'apn://feedback.push.apple.com:2196'
APPLE_DEVELOPMENT_GATEWAY_URI = 'apn://gateway.sandbox.push.apple.com:2195'
APPLE_DEVELOPMENT_FEEDBACK_URI = 'apn://feedback.sandbox.push.apple.com:2196'
cla... | ruby | MIT | 2455d5dc3c80c49b47a24a50386bf585dff3e83a | 2026-01-04T15:51:56.141261Z | false |
nomad-cli/houston | https://github.com/nomad-cli/houston/blob/2455d5dc3c80c49b47a24a50386bf585dff3e83a/lib/houston/notification.rb | lib/houston/notification.rb | require 'json'
module Houston
class Notification
class APNSError < RuntimeError
# See: https://developer.apple.com/library/ios/documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/Chapters/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW12
CODES = {
0 => 'No erro... | ruby | MIT | 2455d5dc3c80c49b47a24a50386bf585dff3e83a | 2026-01-04T15:51:56.141261Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_testing.rb | test/test_testing.rb | # frozen_string_literal: true
require 'test_helper'
describe PublicActivity do
describe 'self.with_tracking' do
after do
PublicActivity.enabled = true
end
it 'enables tracking inside the block' do
PublicActivity.enabled = false
PublicActivity.with_tracking do
assert PublicAct... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_common.rb | test/test_common.rb | # frozen_string_literal: true
require 'test_helper'
describe PublicActivity::Common do
before do
@owner = User.create(name: 'Peter Pan')
@recipient = User.create(name: 'Bruce Wayne')
@options = {
params: {
author_name: 'Peter',
summary: 'Default summary goes here...'
},... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_view_helpers.rb | test/test_view_helpers.rb | # frozen_string_literal: true
require 'test_helper'
describe 'ViewHelpers Rendering' do
include PublicActivity::ViewHelpers
# is this a proper test?
it 'provides render_activity helper' do
activity = mock('activity')
activity.stubs(:is_a?).with(PublicActivity::Activity).returns(true)
activity.expec... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_activist.rb | test/test_activist.rb | # frozen_string_literal: true
require 'test_helper'
describe PublicActivity::Activist do
it 'adds owner association' do
klass = article
assert_respond_to klass, :activist
klass.activist
assert_respond_to klass.new, :activities
case ENV['PA_ORM']
when 'active_record'
assert_equal klass... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_generators.rb | test/test_generators.rb | # frozen_string_literal: true
if ENV['PA_ORM'] == 'active_record'
require 'test_helper'
require 'rails/generators/test_case'
require 'generators/public_activity/migration/migration_generator'
require 'generators/public_activity/migration_upgrade/migration_upgrade_generator'
class TestMigrationGenerator < R... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_activity.rb | test/test_activity.rb | # frozen_string_literal: true
require 'test_helper'
describe 'PublicActivity::Activity Rendering' do
describe '#text' do
subject { PublicActivity::Activity.new(key: 'activity.test', parameters: { one: 1 }) }
specify '#text uses translations' do
subject.save
I18n.config.backend.store_translation... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_tracking.rb | test/test_tracking.rb | # frozen_string_literal: true
require 'test_helper'
describe PublicActivity::Tracked do
describe 'defining instance options' do
subject { article.new }
let :options do
{
key: 'key',
params: { a: 1 },
owner: User.create,
recipient: User.create
}
end
before(... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_helper.rb | test/test_helper.rb | # frozen_string_literal: true
require 'rubygems'
require 'bundler'
Bundler.setup(:default, :test)
if ENV['COV']
require 'simplecov'
SimpleCov.start do
add_filter '/test/'
end
end
$:.unshift File.expand_path('../lib', __dir__)
require 'active_support/testing/setup_and_teardown'
require 'public_activity'
requ... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/test_controller_integration.rb | test/test_controller_integration.rb | # frozen_string_literal: true
require 'test_helper'
class StoringController < ActionView::TestCase::TestController
include PublicActivity::StoreController
include ActionController::Testing
end
describe PublicActivity::StoreController do
it 'stores controller' do
controller = StoringController.new
Publi... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/migrations/004_add_nonstandard_to_activities.rb | test/migrations/004_add_nonstandard_to_activities.rb | # frozen_string_literal: true
class AddNonstandardToActivities < ActiveRecord::Migration[6.1]
def change
change_table :activities do |t|
t.string :nonstandard
end
end
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/migrations/003_create_users.rb | test/migrations/003_create_users.rb | # frozen_string_literal: true
class CreateUsers < ActiveRecord::Migration[6.1]
def self.up
create_table :users do |t|
t.string :name
t.timestamps
end
end
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/migrations/002_create_articles.rb | test/migrations/002_create_articles.rb | # frozen_string_literal: true
class CreateArticles < ActiveRecord::Migration[6.1]
def self.up
create_table :articles do |t|
t.string :name
t.boolean :published
t.belongs_to :user
t.timestamps
end
end
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/test/migrations/001_create_activities.rb | test/migrations/001_create_activities.rb | # frozen_string_literal: true
# Migration responsible for creating a table with activities
class CreateActivities < ActiveRecord::Migration[6.1]
def self.up
create_table :activities do |t|
t.belongs_to :trackable, polymorphic: true
t.belongs_to :owner, polymorphic: true
t.string :key
t.te... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity.rb | lib/public_activity.rb | # frozen_string_literal: true
require 'active_support'
require 'logger'
require 'action_view'
# +public_activity+ keeps track of changes made to models
# and allows you to display them to the users.
#
# Check {PublicActivity::Tracked::ClassMethods#tracked} for more details about customizing and specifying
# ownership ... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/common.rb | lib/public_activity/common.rb | # frozen_string_literal: true
module PublicActivity
# Happens when creating custom activities without either action or a key.
class NoKeyProvided < Exception; end
# Used to smartly transform value from metadata to data.
# Accepts Symbols, which it will send against context.
# Accepts Procs, which it will ex... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/version.rb | lib/public_activity/version.rb | # frozen_string_literal: true
module PublicActivity
# A constant with gem's version
VERSION = '3.0.1'
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/renderable.rb | lib/public_activity/renderable.rb | # frozen_string_literal: true
module PublicActivity
# Provides logic for rendering activities. Handles both i18n strings
# support and smart partials rendering (different templates per activity key).
module Renderable
# Virtual attribute returning text description of the activity
# using the activity's k... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/activity.rb | lib/public_activity/activity.rb | # frozen_string_literal: true
module PublicActivity
# Main model, stores all information about what happened,
# who caused it, when and anything else.
class Activity < inherit_orm("Activity")
end
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/config.rb | lib/public_activity/config.rb | # frozen_string_literal: true
require 'singleton'
module PublicActivity
# Class used to initialize configuration object.
class Config
include ::Singleton
# Evaluates given block to provide DSL configuration.
# @example Initializer for Rails
# PublicActivity::Config.set do
# orm :mongo_m... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/testing.rb | lib/public_activity/testing.rb | # frozen_string_literal: true
# This file provides functionality for testing your code with public_activity
# activated or deactivated.
# This file should only be required in test/spec code!
#
# To enable PublicActivity testing capabilities do:
# require 'public_activity/testing'
module PublicActivity
# Execute th... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/actions/update.rb | lib/public_activity/actions/update.rb | # frozen_string_literal: true
module PublicActivity
# Handles creation of Activities upon destruction and update of tracked model.
module Update
extend ActiveSupport::Concern
included do
after_update :activity_on_update
end
private
# Creates activity upon modification of the tracked mo... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/actions/creation.rb | lib/public_activity/actions/creation.rb | # frozen_string_literal: true
module PublicActivity
# Handles creation of Activities upon destruction and update of tracked model.
module Creation
extend ActiveSupport::Concern
included do
after_create :activity_on_create
end
private
# Creates activity upon creation of the tracked mode... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/actions/destruction.rb | lib/public_activity/actions/destruction.rb | # frozen_string_literal: true
module PublicActivity
# Handles creation of Activities upon destruction of tracked model.
module Destruction
extend ActiveSupport::Concern
included do
before_destroy :activity_on_destroy
end
private
# Records an activity upon destruction of the tracked mod... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/models/adapter.rb | lib/public_activity/models/adapter.rb | # frozen_string_literal: true
module PublicActivity
# Loads database-specific routines for use by PublicActivity.
class Adapter < inherit_orm('Adapter')
end
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/models/activity.rb | lib/public_activity/models/activity.rb | # frozen_string_literal: true
module PublicActivity
class Activity < inherit_orm
end
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/models/activist.rb | lib/public_activity/models/activist.rb | # frozen_string_literal: true
module PublicActivity
# Provides helper methods for selecting activities from a user.
module Activist
# Delegates to configured ORM.
def self.included(base)
base.extend PublicActivity.inherit_orm('Activist')
end
end
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/models/trackable.rb | lib/public_activity/models/trackable.rb | # frozen_string_literal: true
module PublicActivity
# Provides association for activities bound to this object by *trackable*.
module Trackable
# Delegates to ORM.
def self.included(base)
base.extend PublicActivity.inherit_orm('Trackable')
end
end
end
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/roles/tracked.rb | lib/public_activity/roles/tracked.rb | # frozen_string_literal: true
module PublicActivity
# Main module extending classes we want to keep track of.
module Tracked
extend ActiveSupport::Concern
# A shortcut method for setting custom key, owner and parameters of {Activity}
# in one line. Accepts a hash with 3 keys:
# :key, :owner, :param... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/roles/deactivatable.rb | lib/public_activity/roles/deactivatable.rb | # frozen_string_literal: true
module PublicActivity
# Enables per-class disabling of PublicActivity functionality.
module Deactivatable
extend ActiveSupport::Concern
included do
class_attribute :public_activity_enabled_for_model
set_public_activity_class_defaults
end
# Returns true if... | ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/orm/active_record.rb | lib/public_activity/orm/active_record.rb | # frozen_string_literal: true
require 'active_record'
require_relative 'active_record/activity'
require_relative 'active_record/adapter'
require_relative 'active_record/activist'
require_relative 'active_record/trackable'
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
public-activity/public_activity | https://github.com/public-activity/public_activity/blob/29bbd6e788950b5528c512bb8361071f187f3230/lib/public_activity/orm/mongoid.rb | lib/public_activity/orm/mongoid.rb | # frozen_string_literal: true
require_relative "mongoid/activity.rb"
require_relative "mongoid/adapter.rb"
require_relative "mongoid/activist.rb"
require_relative "mongoid/trackable.rb"
| ruby | MIT | 29bbd6e788950b5528c512bb8361071f187f3230 | 2026-01-04T15:52:00.725138Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.