SkillAgentSearch skills...

Parshal

A lightweight wrapper for Mashal that dumps not all fields but partial attributes

Install / Use

/learn @scaleout/Parshal
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

= Parshal A lightweight wrapper for Marshal.

Parshal allows partially marshalling objects via accessor methods.

== Prerequisites

  • Ruby 1.8 or later
  • activesupport

== Synopsys class A include Parshallable attr_accessor :x, :y, :z, :b attr_accessor :p, :q

parshal :x, :y, :z, :b # ignores :p and :q end

class B include Parshallable attr_accessor :m, :n

parshal :m, :n end

a = A.new a.x = :x a.y = 1 a.z = {:hoge => :hage} a.p = :unused a.q = :unused

b = B.new b.m = 'm' b.n = [1, 2, 3] a.b = b

a = Marshal.load(Marshal.dump(a)) p a

== Copyright :Author Yugui (Yuki Sonoda) yugui@yugui.jp :Copyright Copyright (c) 2009 Yugui (Yuki Sonoda). :License MIT license

View on GitHub
GitHub Stars12
CategoryDevelopment
Updated6y ago
Forks0

Languages

Ruby

Security Score

60/100

Audited on Aug 13, 2019

No findings