Sha256: 51c27be99fc0f374e40e1c6a5adbdd4e7c2d2320b349e3461cb2f739a0822717

Contents?: true

Size: 867 Bytes

Versions: 10

Compression:

Stored size: 867 Bytes

Contents

use strict; use warnings;
package YAML::Marshall;

use YAML::Node ();

sub import {
    my $class = shift;
    no strict 'refs';
    my $package = caller;
    unless (grep { $_ eq $class} @{$package . '::ISA'}) {
        push @{$package . '::ISA'}, $class;
    }

    my $tag = shift;
    if ( $tag ) {
        no warnings 'once';
        $YAML::TagClass->{$tag} = $package;
        ${$package . "::YamlTag"} = $tag;
    }
}

sub yaml_dump {
    my $self = shift;
    no strict 'refs';
    my $tag = ${ref($self) . "::YamlTag"} || 'perl/' . ref($self);
    $self->yaml_node($self, $tag);
}

sub yaml_load {
    my ($class, $node) = @_;
    if (my $ynode = $class->yaml_ynode($node)) {
        $node = $ynode->{NODE};
    }
    bless $node, $class;
}

sub yaml_node {
    shift;
    YAML::Node->new(@_);
}

sub yaml_ynode {
    shift;
    YAML::Node::ynode(@_);
}

1;

Version data entries

10 entries across 5 versions & 1 rubygems

Version Path
javonet-ruby-sdk-2.1.1 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.1.1 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.1.0 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.1.0 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.0.4 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.0.4 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.0.1 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.0.1 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.0.0 lib/javonet-ruby-sdk/Binaries/Perl/Linux/X64/deps/lib/perl5/YAML/Marshall.pm
javonet-ruby-sdk-2.0.0 lib/javonet-ruby-sdk/Binaries/Perl/MacOs/X64/deps/lib/perl5/YAML/Marshall.pm