class Object

Constants

Enumerator

Public Instance Methods

open_with_options_hash(file, mode = nil, perm_or_options = Backports::Undefined) { |f| ... } click to toggle source
# File lib/backports/1.9.1/file/open.rb, line 7
def open_with_options_hash(file, mode = nil, perm_or_options = Backports::Undefined)
  mode, perm = Backports.combine_mode_perm_and_option(mode, perm_or_options)
  perm ||= 0666 # Avoid error on Rubinius, see issue #52
  if block_given?
    open_without_options_hash(file, mode, perm){|f| yield f}
  else
    open_without_options_hash(file, mode, perm)
  end
end
try(*a) { |self| ... } click to toggle source
# File lib/backports/rails/kernel.rb, line 6
def try(*a, &b)
  if a.empty? || respond_to?(a.first)
    if a.empty? && block_given?
      if b.arity == 0
        instance_eval(&b)
      else
        yield self
      end
    else
      public_send(*a, &b)
    end
  end
end