Sha256: 3b78894de2cb684811ac116a3ef8b334e09fcd91873fd68ea419527b29adc503
Contents?: true
Size: 1.29 KB
Versions: 4
Compression:
Stored size: 1.29 KB
Contents
# Namespace # ======================================================================== class Thor module CoreExt # Definitions # ======================================================================== # A hash with indifferent access and magic predicates. # # hash = HashWithIndifferentAccess.new 'foo' => 'bar', 'baz' => 'bee', 'force' => true # # hash[:foo] #=> 'bar' # hash['foo'] #=> 'bar' # hash.foo? #=> true # class HashWithIndifferentAccess < ::HashWithIndifferentAccess #:nodoc: protected # ======================================================================== # Magic predicates. For instance: # # options.force? # => !!options['force'] # options.shebang # => "/usr/lib/local/ruby" # options.test_framework?(:rspec) # => options[:test_framework] == :rspec # def method_missing(method, *args) method = method.to_s if method =~ /^(\w+)\?$/ if args.empty? !!self[$1] else self[$1] == args.first end else self[method] end end public # end protected *************************************************** end # /Namespace # ======================================================================== end # module CoreExt end # class Thor
Version data entries
4 entries across 4 versions & 1 rubygems