Skip to content

Instantly share code, notes, and snippets.

@olistik
Last active August 29, 2015 14:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save olistik/bb3b2ebce1a72913d5a6 to your computer and use it in GitHub Desktop.
Save olistik/bb3b2ebce1a72913d5a6 to your computer and use it in GitHub Desktop.
Be Brave in Ruby-land
module Brave
def self.be(exception_classes = [NoMethodError])
begin
yield
rescue *exception_classes => e
end
end
end
require 'hashie'
require 'monads'
module Brave
def self.be(exception_classes = [NoMethodError])
begin
yield
rescue *exception_classes => e
end
end
def self.wrap_hash(object)
Monads::Optional.new(Hashie::Mash.new(object))
end
end
Brave.wrap_hash(params).profile.resume.tempfile.path.value
require 'hashie'
require 'monads'
Monads::Optional.new(Hashie::Mash.new(params)).profile.resume.tempfile.path.value
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment