Skip to content
forked from scaruby/scaruby

Ruby-like Lightweight Scripting Library for Scala

License

Notifications You must be signed in to change notification settings

shuheik/scaruby

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Scaruby: Ruby-like lightweight scripting library for Scala

Join the chat at https://gitter.im/scaruby/scaruby Build Status Maven Central Scaladoc Reference Status

Scaruby is not a thin layer of java.io but a thick layer of it. Users of Scaruby don't need to know the detail of java.io. Instead, Scaruby provides the way to do file I/O independently.

Features

  • Builtin loan pattern
  • Simple operation can be done by simple method call
  • Base64 encode/decode
  • Every SReader/Swriter can be used in for-expression, which is implemented as foreach method.
  • Support reading text/binary content from SURL
  • No overloading! Instead, use type classes or default arguments
  • Additional features will be added as needed

Usage

Now Scaruby supports Scala 2.11.X and Scala 2.12.X.

Add the following lines to your build.sbt:

resolvers += "Sonatype OSS Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots"

libraryDependencies += "com.github.scaruby" %% "scaruby" % "0.2"

and you can use Scaruby like the following after importing the package com.github.scaruby._:

import com.github.scaruby._

val content = SFile.read("file.txt")
import com.github.scaruby._

val input = "Hello, World!"
val encoded = SBase64.encode64(input.getBytes("UTF-8"))
val decoded = new String(SBase64.decode64(encoded), "UTF-8")
assert(input == decoded)
import com.github.scaruby._
val content = for { 
  r <- SURL("https://srad.jp/").openReader
} r.readAll
println(content)

About

Ruby-like Lightweight Scripting Library for Scala

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%