Sha256: 0c7f2b7a4562038b015550e01b5cb4aef4f4123718b4dfcd0e2b508398879bae

Contents?: true

Size: 288 Bytes

Versions: 14

Compression:

Stored size: 288 Bytes

Contents

class Array
  def args
    flatten.map{|a| a.args}.flatten
  end
end

class Symbol
  def args
    [to_s]
  end
end

class String
  def args
    (self =~ /\w+\s+\w+/) ? self.split : self
  end
end

def last_option *args
  last = args.flatten.last
  last.kind_of?(Hash) ? last : {}    
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
sugar-high-0.2.6 lib/sugar-high/arguments.rb
sugar-high-0.2.5 lib/sugar-high/arguments.rb
sugar-high-0.2.4 lib/sugar-high/arguments.rb
sugar-high-0.2.2 lib/sugar-high/arguments.rb
sugar-high-0.2.1 lib/sugar-high/arguments.rb
sugar-high-0.2.0 lib/sugar-high/arguments.rb
sugar-high-0.1.8 lib/sugar-high/arguments.rb
sugar-high-0.1.7 lib/sugar-high/arguments.rb
sugar-high-0.1.6 lib/sugar-high/arguments.rb
sugar-high-0.1.5 lib/sugar-high/arguments.rb
sugar-high-0.1.4 lib/sugar-high/arguments.rb
sugar-high-0.1.2 lib/sugar-high/arguments.rb
sugar-high-0.1.1 lib/sugar-high/arguments.rb
sugar-high-0.1.0 lib/sugar-high/arguments.rb