psych

    3熱度

    3回答

    這個問題已經被問過:Read and write YAML files without destroying anchors and aliases? 我不知道如何解決這個問題有許多錨和別名? 感謝

    5熱度

    2回答

    /usr/share/ruby-rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/i686-linux/psych.so: warning: already initialized constant ANY /usr/share/ruby-rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/i686-linux/psych.so

    0熱度

    1回答

    我有一個describe.by {psych}應用於數據框的結果。結果是一個列表。 List of 1000 $ 1 :Classes ‘psych’, ‘describe’ and 'data.frame': 20 obs. of 13 variables: ..$ var : int [1:20] 1 2 3 4 5 6 7 8 9 10 ... ..$ n : nu

    2熱度

    2回答

    我在使用delayed_job(3.0.3)和ruby 1.9.3時遇到了問題。之前我們使用的ruby 1.8.7與yaml syck解析器一起提供,它讀取爲ruby對象(包括attr_accessors)設置的所有屬性,但升級到1.9.3時,yaml解析器切換到了psych(這是重新編譯的)寫入),並且不考慮除數據庫中保留的任何屬性。我們怎樣才能讓心理考慮到attr_accessors。我試圖切

    1熱度

    1回答

    我使用Sych這舊的代碼做: yaml_as "tag:yaml.org,2002:#{self}" def to_yaml(opts = {}) YAML::quick_emit(self, opts) do |out| out.map(taguri, to_yaml_style) do |map| map.add('name', name) map

    2熱度

    1回答

    我正在使用DataMapper進行數據庫訪問。我的目標是將模型作爲只讀對象發送到Web服務。這是我目前的嘗試: class User include DataMapper::Resource def to_yaml(opts = {}) mini_me = OpenStruct.new instance_variables.each do |var|

    0熱度

    1回答

    我有一些數據表,從文本文件導入。 然後我使用describe(table)功能從psych包。 它返回每個變量的差異,平均值等,包括布爾值,儘管它們標有星號。 age 1 5000 66.65 6.65 67.00 66.88 7.41 44.00 79.00 35.00 -0.33 -0.39 0.13 smokes* 2 5000 1.39 0.49 1.00 1.36 0.00 1.00

    9熱度

    3回答

    我在我的Rails應用程序中實現了類似於功能的紙道。爲了做到這一點,我在YAML中序列化對象。我有item_at_version方法,其基本上做YAML::load(cached_object) - 這工作相當不錯,但是,我不知道爲什麼,有時它返回undefined class/module _class name_。 它與事件,對話,注意等模型一起工作,但沒有任何理由,它似乎拋出像數據集,評論,

    10熱度

    3回答

    根據http://yaml.org/spec/current.html#id2509980在YAML文件中的評論是一個演示的細節,不得在序列化/表示圖(http://yaml.org/spec/current.html#representation/)。它看起來像Psych是根據規範進行解析並丟失了註釋,這意味着當文件包含註釋時,無法解析YAML文件並再次以完全相同的方式將其序列化。在我看來,這很

    6熱度

    1回答

    我在Ruby on Rails應用程序中使用ActiveRecord :: Store模塊時遇到了一個奇怪的問題。據我所知,這個模塊使用'serialize'方法,所以它只是使用ruby內置的心靈寶石將數據序列化爲yaml格式。 它的工作原理確定的大部分時間,但有時我得到500錯誤以下消息: LoadError (cannot load such file -- enc/trans/single_