Sha256: d6769f0cad79fadb477ca8224bffdd6e508c5186673f2dd79fe0331ca9f05c88

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

class String
  def p
    puts self
  end

  def expa
    File.expand_path(self)
  end

  def f
    expa
  end

  def parse_excel
    if File.file?(File.expand_path(self))
      Kernel.parse_excel(File.expand_path(self))
    else
      raise "File not found: #{self}"
    end
  end

  def parse_csv
    if File.file?(File.expand_path(self))
      Kernel.parse_csv(File.expand_path(self))
    else
      raise "File not found: #{self}"
    end
  end

  def parse_json
    if File.file?(File.expand_path(self))
      Kernel.parse_json(File.expand_path(self))
    else
      raise "File not found: #{self}"
    end
  end

  def parse
    if File.file?(File.expand_path(self))
      if self =~ /\.xlsx?$/i
        parse_excel
      elsif self =~ /\.csv$/i
        parse_csv
      elsif self =~ /\.json$/i
        parse_json
      else
        raise "File type not supported: #{self}"
      end
    else
      raise "File not found: #{self}"
    end
  end

  def vd
    if File.file?(File.expand_path(self))
      system "vd '#{File.expand_path(self)}'"
      print "\033[5 q"
    else
      raise "File not found: #{self}"
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
arql-0.4.3 lib/arql/ext/string.rb
arql-0.4.2 lib/arql/ext/string.rb
arql-0.4.1 lib/arql/ext/string.rb
arql-0.4.0 lib/arql/ext/string.rb
arql-0.3.31 lib/arql/ext/string.rb
arql-0.3.30 lib/arql/ext/string.rb
arql-0.3.29 lib/arql/ext/string.rb
arql-0.3.28 lib/arql/ext/string.rb
arql-0.3.27 lib/arql/ext/string.rb
arql-0.3.26 lib/arql/ext/string.rb
arql-0.3.25 lib/arql/ext/string.rb
arql-0.3.24 lib/arql/ext/string.rb