Class: Perl::Value::Hash

Inherits:
Object show all
Defined in:
lib/perl/value/hash.rb

Constant Summary collapse

HV_DISABLE_UVAR_XKEY =
0x01
HV_FETCH_ISSTORE =
0x04
HV_FETCH_ISEXISTS =
0x08
HV_FETCH_LVALUE =
0x10
HV_FETCH_JUST_SV =
0x20
HV_DELETE =
0x40

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = nil) ⇒ Hash

Returns a new instance of Hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/perl/value/hash.rb', line 56

def initialize(args = nil)
  @perl = Perl.PL_curinterp
  @hash = nil
  @hv = nil

  case args
  when Hash
    @hash = args
  when nil
  else
    raise "Don't know how to handle #{args.class} (#{args.inspect})"
  end
end

Class Method Details

.to_perl(hash) ⇒ Object



16
17
18
# File 'lib/perl/value/hash.rb', line 16

def to_perl(hash)
  build_hv(Perl.PL_curinterp, hash)
end

Instance Method Details

#to_perlObject



70
71
72
# File 'lib/perl/value/hash.rb', line 70

def to_perl
  @hv ||= self.class.send(:build_hv, @perl, @hash)
end