New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

erlang-terms

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

erlang-terms

  • 2.0.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Erlang::Terms

Travis Coverage Status Gem Docs Inline docs

Includes simple immutable classes that represent Erlang's atom, binary, bitstring, compressed, export, function, list, map, nil, pid, port, reference, string, and tuple.

Installation

Add this line to your application's Gemfile:

gem 'erlang-terms', '~> 2.0'

And then execute:

$ bundle

Or install it yourself as:

$ gem install erlang-terms

Usage

The following classes show the Erlang representation followed by the corresponding Ruby representation.

See erlang-etf for more information.

Erlang::Atom

Atom     = 'test',
AtomUTF8 = 'Ω'.
atom = Erlang::Atom[:test]
# => :test
atom_utf8 = Erlang::Atom[:Ω, utf8: true]
# => Erlang::Atom["Ω", utf8: true]

Erlang::Binary

Binary0 = <<>>,
Binary1 = <<"test">>,
Binary2 = <<0,1,2>>.
binary0 = Erlang::Binary[]
# => ""
binary1 = Erlang::Binary["test"]
# => "test"
binary2 = Erlang::Binary[0,1,2]
# => "\x00\x01\x02"

Erlang::Bitstring

Bitstring0 = <<1:7>>,
Bitstring1 = <<"test",2:3>>.
bitstring0 = Erlang::Bitstring[1, bits: 7]
# => Erlang::Bitstring[1, bits: 7]
bitstring1 = Erlang::Bitstring["test", 2, bits: 3]
# => Erlang::Bitstring[116, 101, 115, 116, 2, bits: 3]

Erlang::Export

Module   = erlang,
Function = now,
Arity    = 0,
Export   = fun Module:Function/Arity.
export = Erlang::Export[:erlang, :now, 0]
# => Erlang::Export[:erlang, :now, 0]

Erlang::Float

Float = 1.0e12.
float = Erlang::Float[1.0e12]
# => 1.00000000000000000000e+12

Erlang::List

Improper List
List = [a | b].
list = Erlang::List[:a] + :b
# => Erlang::List[:a] + :b
list.improper?
# => true
Proper List
List = [a, b].
list = Erlang::List[:a, :b]
# => [:a, :b]
list.improper?
# => false

Erlang::Map

Map = #{atom => 1}.
map = Erlang::Map[:atom, 1]
# => {:atom => 1}

Erlang::Nil

Nil = [].
erlang_nil = Erlang::Nil
# => []

Erlang::Pid

Pid = self().

%% or

Id     = 100,
Serial = 5,
Pid    = pid(0, Id, Serial).

%% or

Pid = list_to_pid("<0.100.5>").
pid = Erlang::Pid[:"node@host", 100, 5, 0]
# => Erlang::Pid[:"node@host", 100, 5, 0]

Erlang::Port

Port = hd(erlang:ports()).
port = Erlang::Port[:"nonode@nohost", 0, 0]
# => Erlang::Port[:"nonode@nohost", 0, 0]

Erlang::Reference

Reference = erlang:make_ref().
reference = Erlang::Reference[:"nonode@nohost", 0, [168, 2, 0]]
# => Erlang::Reference[:"nonode@nohost", 0, [168, 2, 0]]

Erlang::String

String = "test".
string = Erlang::String["test"]
# => Erlang::String["test"]

Erlang::Tuple

Tuple = {atom, 1}.
tuple = Erlang::Tuple[:atom, 1]
# => Erlang::Tuple[:atom, 1]

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 03 Jun 2017

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

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc