Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Commits on Sep 19, 2015
  1. @jdantonio

    Replaced `ThreadSafe::Map` with successor `Concurrent::Map`.

    jdantonio authored
    The thread_safe gem is being deprecated and all its code has been merged
    into the concurrent-ruby gem. The new class, Concurrent::Map, is exactly
    the same as its predecessor except for fixes to two bugs discovered
    during the merge.
Commits on Aug 11, 2015
  1. @rodzyn

    Rename match_attribute_method? to matched_attribute_method

    rodzyn authored
    `match_attribute_method?` is a bit confusing because it suggest
    that a return value is a boolean which is not true.
Commits on Jul 19, 2015
  1. @schneems

    Freeze string literals when not mutated.

    schneems authored
    I wrote a utility that helps find areas where you could optimize your program using a frozen string instead of a string literal, it's called [let_it_go]( After going through the output and adding `.freeze` I was able to eliminate the creation of 1,114 string objects on EVERY request to [codetriage]( How does this impact execution?
    To look at memory:
    require 'get_process_mem'
    mem =
    1_114.times { " " }
    before = mem.mb
    after = mem.mb
    puts "Diff: #{after - before} mb"
    Creating 1,114 string objects results in `Diff: 0.03125 mb` of RAM allocated on every request. Or 1mb every 32 requests.
    To look at raw speed:
    require 'benchmark/ips'
    number_of_objects_reduced = 1_114
    Benchmark.ips do |x|"freeze")    { number_of_objects_reduced.times { " ".freeze } }"no-freeze") { number_of_objects_reduced.times { " " } }
    We get the results
    Calculating -------------------------------------
                  freeze     1.428k i/100ms
               no-freeze   609.000  i/100ms
                  freeze     14.363k (± 8.5%) i/s -     71.400k
               no-freeze      6.084k (± 8.1%) i/s -     30.450k
    Now we can do some maths:
    ips = 6_226k # iterations / 1 second
    call_time_before = 1.0 / ips # seconds per iteration 
    ips = 15_254 # iterations / 1 second
    call_time_after = 1.0 / ips # seconds per iteration 
    diff = call_time_before - call_time_after
    number_of_objects_reduced * diff * 100
    # => 0.4530373333993266 miliseconds saved per request
    So we're shaving off 1 second of execution time for every 220 requests. 
    Is this going to be an insane speed boost to any Rails app: nope. Should we merge it: yep. 
    p.s. If you know of a method call that doesn't modify a string input such as [String#gsub]( please [give me a pull request to the appropriate file](, or open an issue in LetItGo so we can track and freeze more strings. 
    Keep those strings Frozen
Commits on May 29, 2015
  1. formatting changes

    unknown authored
Commits on Apr 24, 2015
  1. @imtayadeway
  2. @imtayadeway
  3. @imtayadeway

    Fix grammar/style: break up long sentence.

    imtayadeway authored
    A conjunction was needed to make these sentences correct. Breaking them
    up seemed like a better option.
    [ci skip]
  4. @imtayadeway
Commits on Dec 4, 2014
  1. @sgrif

    Correctly handle multiple attribute method prefix/suffixes which match

    sgrif authored
    Active Record defines `attribute_method_suffix :?`. That suffix will
    match any predicate method when the lookup occurs in Active Model. This
    will make it incorrectly decide that `id_changed?` should not exist,
    because it attempts to determine if the attribute `id_changed` is
    present, rather than `id` with the `_changed?` suffix. Instead, we will
    look for any correct match.
Commits on Jan 6, 2014
  1. @carlosantoniodasilva
Commits on Dec 25, 2013
  1. @aditya-kapoor

    Added Backslashes to ActiveModel::AttributeMethods to prevent unwante…

    aditya-kapoor authored
    …d links in the rdoc + some other doc fixes.[ci skip]
Commits on Dec 19, 2013
  1. @vijaydev
Commits on Dec 2, 2013
  1. @akshay-vishnoi
Commits on Aug 20, 2013
  1. @aditya-kapoor

    fixed a typo

    aditya-kapoor authored
Commits on Jul 2, 2013
  1. @tenderlove
  2. @tenderlove
Commits on Jul 1, 2013
  1. @tenderlove
Commits on Jun 27, 2013
  1. @pftg
Commits on May 2, 2013
  1. @patricksrobertson

    Convert ActiveModel to 1.9 hash syntax.

    patricksrobertson authored
    I also attempted to fix other styleguide violations such as
    { a: :b } over {a: :b} and foo(b: 'bar') over foo( b: 'bar' ).
Commits on Apr 28, 2013
  1. @fxn

    pass over the code comments

    fxn authored
    * Highlights the requirement of an attributes method.
    * Removes some details that depend on the implementation of the class including the module.
    * Applies guidelines here and there.
Commits on Jan 7, 2013
  1. @goshakkk
Commits on Dec 14, 2012
  1. @thedarkone

    Replace some global Hash usages with the new thread safe cache.

    thedarkone authored
    Summary of the changes:
     * Add thread_safe gem.
     * Use thread safe cache for digestor caching.
     * Replace manual synchronization with ThreadSafe::Cache in Relation::Delegation.
     * Replace @attribute_method_matchers_cache Hash with ThreadSafe::Cache.
     * Use TS::Cache to avoid the synchronisation overhead on listener retrieval.
     * Replace synchronisation with TS::Cache usage.
     * Use a preallocated array for performance/memory reasons.
     * Update the controllers cache to the new AS::Dependencies::ClassCache API.
       The original @controllers cache no longer makes much sense after @tenderlove's
       changes in 7b6bfe8 and f345e23.
     * Use TS::Cache in the connection pool to avoid locking overhead.
     * Use TS::Cache in ConnectionHandler.
Commits on Nov 25, 2012
  1. @senny
Commits on Oct 30, 2012
  1. @gazay
Commits on Oct 29, 2012
  1. @nikitug

    Provide a call stack for deprecation warnings where needed.

    nikitug authored
    It's sometimes hard to quickly find where deprecated call was performed, especially in case of migrating between Rails versions. So this is an attempt to improve the call stack part of the warning message by providing caller explicitly.
Commits on Oct 21, 2012
  1. minor edits in AM documentation [ci skip]

    Francesco Rodriguez authored
Commits on Aug 4, 2012
  1. @vijaydev

    Merge branch 'master' of

    vijaydev authored
Commits on Aug 2, 2012
  1. @fxn
  2. @fxn
Commits on Jul 28, 2012
  1. add example to ActiveModel::MissingAttributeError [ci skip]

    Francesco Rodriguez authored
Commits on Jun 27, 2012
  1. @carlosantoniodasilva
  2. @carlosantoniodasilva

    Cleanup attribute methods a bit, use map! when accepting *args

    carlosantoniodasilva authored
    Since we're dealing with a new array instance, it's safe to use map! and
    we avoid an extra array object.
    Also remove the symbolize_keys! from AttributeMethodMatcher, since it's
    an internal class that always receives symbol keys from the prefix/suffix
    methods implementations.
Commits on Jun 22, 2012
  1. add :nodoc: to internal implementations [ci skip]

    Francesco Rodriguez authored
  2. @vijaydev
  3. @vijaydev
Something went wrong with that request. Please try again.