Class: ErlangConfig::ErlBinary

Inherits:
ErlTerm
  • Object
show all
Defined in:
lib/erlang_config/erlbinary.rb

Instance Attribute Summary

Attributes inherited from ErlTerm

#str

Instance Method Summary collapse

Methods inherited from ErlTerm

decode, #initialize

Constructor Details

This class inherits a constructor from ErlangConfig::ErlTerm

Instance Method Details

#to_rubyObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'lib/erlang_config/erlbinary.rb', line 3

def to_ruby
  self.str.gsub!(/[<>]/,"")
  bin_els = self.str.split(",")
  els = bin_els.map { |el|
    if el[/^[0-9]+$/]
      el.to_i
    elsif el[/^"/]
      el.gsub(/"/,"")
    end
  }
  els.length > 1 ? els : els[0]
end