diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2018-12-20 17:38:32 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-20 17:38:32 +0900 |
commit | 3e50a1bcd4b5f3ce26ec94ba061d039c0a6f8062 (patch) | |
tree | cfd772beae014e0d63ac638c0450a407753acb44 /activemodel | |
parent | bf01cc6744a3593c6256ab6765d7d7a500696bd5 (diff) | |
parent | f3c866a743bc6edc9b67b241e65e6acfccfd3992 (diff) | |
download | rails-3e50a1bcd4b5f3ce26ec94ba061d039c0a6f8062.tar.gz rails-3e50a1bcd4b5f3ce26ec94ba061d039c0a6f8062.tar.bz2 rails-3e50a1bcd4b5f3ce26ec94ba061d039c0a6f8062.zip |
Merge pull request #30973 from k0kubun/prefer-block-parameter
Unify _read_attribute definition to use &block
Diffstat (limited to 'activemodel')
-rw-r--r-- | activemodel/lib/active_model/attribute_set.rb | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/activemodel/lib/active_model/attribute_set.rb b/activemodel/lib/active_model/attribute_set.rb index a890ee3932..4679b33852 100644 --- a/activemodel/lib/active_model/attribute_set.rb +++ b/activemodel/lib/active_model/attribute_set.rb @@ -37,16 +37,8 @@ module ActiveModel attributes.each_key.select { |name| self[name].initialized? } end - if defined?(JRUBY_VERSION) - # This form is significantly faster on JRuby, and this is one of our biggest hotspots. - # https://github.com/jruby/jruby/pull/2562 - def fetch_value(name, &block) - self[name].value(&block) - end - else - def fetch_value(name) - self[name].value { |n| yield n if block_given? } - end + def fetch_value(name, &block) + self[name].value(&block) end def write_from_database(name, value) |