deep_transform_keys!

deep_transform_keys!(&block) Instance Public methods Destructively convert all keys by using the block operation. This includes the keys from the root hash and from all nested hashes and arrays.

except!

except!(*keys) Instance Public methods Replaces the hash without the given keys.

deep_transform_keys

deep_transform_keys(&block) Instance Public methods Returns a new hash with all keys converted by the block operation. This includes the keys from the root hash and from all nested hashes and arrays. hash = { person: { name: 'Rob', age: '28' } } hash.deep_transform_keys{ |key| key.to_s.upcase } # => {"PERSON"=>{"NAME"=>"Rob", "AGE"=>"28"}}

at_noon

at_noon() Instance Public methods Alias for: middle_of_day

session

session() Instance Public methods

atomic_write

atomic_write(file_name, temp_dir = Dir.tmpdir) Class Public methods Write to a file atomically. Useful for situations where you don't want other processes or threads to see half-written files. File.atomic_write('important.file') do |file| file.write('hello') end If your temp directory is not on the same filesystem as the file you're trying to write, you can provide a different temporary directory. File.atomic_write('/data/something.important', '/data/tmp') do |file| file.write

html_escape

html_escape(s) Class Public methods A utility method for escaping HTML tag characters. This method is also aliased as h. In your ERB templates, use this method to escape any unsafe content. For example: <%=h @person.name %> puts html_escape('is a > 0 & a < 10?') # => is a &gt; 0 &amp; a &lt; 10? h

slice

slice(*keys) Instance Public methods Returns a new ActionController::Parameters instance that includes only the given keys. If the given keys don't exist, returns an empty hash. params = ActionController::Parameters.new(a: 1, b: 2, c: 3) params.slice(:a, :b) # => {"a"=>1, "b"=>2} params.slice(:d) # => {}

replace

replace(other_array) Instance Public methods Replaces this collection with other_array. This will perform a diff and delete/add only records that have changed. class Person < ActiveRecord::Base has_many :pets end person.pets # => [#<Pet id: 1, name: "Gorby", group: "cats", person_id: 1>] other_pets = [Pet.new(name: 'Puff', group: 'celebrities'] person.pets.replace(other_pets) person.pets # => [#<Pet id: 2, name: "Puff", group: "celebrities", person_id: 1>

current_hash

current_hash() Instance Public methods