`
qqdenghaigui
  • 浏览: 120941 次
  • 性别: Icon_minigender_1
  • 来自: 杭州
社区版块
存档分类
最新评论

ruby 之 Serializes

 
阅读更多

ruby的序列化类是 Marshalclass Klass

  def initialize(str)
    @str = str
  end
  def say_hello
    @str
  end
end

o = Klass.new("hello\n")
data = Marshal.dump(o)  将o序列化
obj = Marshal.load(data) 反序列化获得o 
obj.say_hello  #=> "hello\n"

 

分享到:
评论

相关推荐

    simple_json_api:实现 JSON API 规范的基本序列化程序

    SimpleJsonApi 遵循规范呈现 json 的 。... SimpleJsonApi :: ResourceSerializer serializes :projects , model : Project attribute :id attribute :name , key : :project_name attribute :description att

    simple_json_api-rails

    SimpleJsonApi::Rails 遵循规范呈现 json 的 。 安装 将此行添加到应用程序的 Gemfile 中... serializes :projects , model : Project attribute :id attribute :name , key : :project_name attribute :descripti

    MAX9247_Datasheet.pdf

    serializes 27 bits of parallel data into a serial-data stream. Eighteen bits of video data and 9 bits of control data are encoded and multiplexed onto the serial interface, reducing the serial-data ...

    Android代码-交互式的 Canvas

    The library is based on pretty dumb method: Picture class has writeToStream and createFromStream methods which serializes and deserializes Picture object respectively. After serialization byte array ...

    KoDB:具有对象序列化的基于YAML的可移植Python nosql数据库库

    数据库基于YAML的nosql数据库库。用法在dist获取最新版本,然后解压缩并运行... python setup.py install 使用... KoDB ( "ko-test.db" , load_type = "load" ) # Serializes all of the objects in the database.N

    Prototype Cheat Sheet

    - **`serialize(formElement[, getHash=false])`**: Serializes a form into a URL-encoded string for use in an AJAX request. - **`serializeElements(elements[, getHash=false])`**: Serializes a collection ...

    C#_List 的序列化.doc

    // Serializes the class, writes it to disk, and closes the TextWriter. s.Serialize(myWriter, myRootClass); myWriter.Close(); } } public class MyRootClass { public List<Item> Items { get; set;...

    CoursesManager:GIN314 等级的 HWK-2

    * Serializes them * Deserializes them * Format them in a new DB File * Creates an Index File for DB * Provides a By-Index Search Engine 注意:可以做更多的优化,但现在只是坚持 HWK 的要求。

    BFO: Batch-File Operations on Massive Files for Consistent Performance Improvement

    This singlefile pattern essentially serializes accesses to batched files one by one, resulting in a large number of non-sequential, random, and often dependent I/Os between file data and metadata at ...

    NVIDIA - Understanding and Using Atomic Memory Operations - Slides (S3101-Atomic-Memory-Operations)-计算机科学

     Uninterruptable read-modify-write memory operation— Requested by threads— Updates a value at a specific address Serializes contentious updates from multiple threads Enables co-ordination ...

    Java中使用JWT生成Token进行接口鉴权实现方法

    //Builds the JWT and serializes it to a compact, URL-safe string return builder.compact(); } } ``` 使用JWT进行接口鉴权 在后续请求中,客户端可以将JWT信息作为请求头,发给服务端。服务端可以使用以下...

    Sortable前端框架

    # Sortable Sortable is a <s>minimalist</s> JavaScript library for reorderable drag-and-drop lists. ... ## Features ... * Can drag from one list to another or within the same list * CSS animation when ...

Global site tag (gtag.js) - Google Analytics