You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

lector

Package Overview
Dependencies
Maintainers
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

lector

0.0.7
bundlerRubygems
Version published
Maintainers
4
Created
Source

lector reads Ruby data from strings or files without necessarily evaluating either.

Oh yeah, and the build status? We have one of those: Build Status

Usage

Reading Strings

> require 'lector'
 => true
> Lector::read_s("{x: 11, :pants? => false}")
 => {:x=>11, :pants?=>false} 

Read-Eval

# read-eval is off by default:
> Lector::read_s("{three: #='1+2'}")
RuntimeError: Evaluation isn't allowed if :read_eval is false

# but when you turn it on...
> Lector::read_s("{three: #='1+2'}", :read_eval => true)
 => {:three=>3} 

Please see the tests for more usage examples.

Rationale

Ruby's literal support for hashes, arrays, keywords, numbers, and strings makes Ruby data slightly more expressive than JSON and arguably as expressive as YAML.

Ruby could be a decent format for representing things like markup or configuration data. This library allows you to digest Ruby data strings and files without having to worry if arbitrary code will execute.

Thanks

This library started as a fork of Michael Fogus and Alex Redington's clj.rb, a library for parsing Clojure data from Ruby. A big thanks to them for getting this party started.

FAQs

Package last updated on 07 May 2012

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.