similar to: yaml: custom saving and loading of specific classes

Displaying 20 results from an estimated 10000 matches similar to: "yaml: custom saving and loading of specific classes"

2006 Jan 11
0
Limit attributes written out by to_yaml
I want to write out a series of records to a text file so that I can quickly edit them and then upload then again into the database. To do this I am using YAML and some code that looks like this: item = Item.find 153 File.open( ''item.yaml'', ''w'' ) do |out| YAML.dump( item, out ) end This dumps out all the field names and values which are stored in the
2012 Jul 05
1
hash to_yaml in erb template not giving valid yaml
Hi, I want to use a file resource to write a facts.yaml file for Mcollective. For some reason it won''t provide a valid yaml format if I dump my scope to hash and convert to_yaml. file { "/etc/mcollective/facts.yaml" : owner => root, group => root, mode => 400, loglevel => debug, #content => inline_template("<%= scope.to_hash.reject {
2008 Apr 16
2
Question about yaml. Thank you !!
Hi friends: I tried to convert a model object to yaml(use to_yaml method), and after that, I would like to convert the yaml(string type) back to the model object. But when I use YAML::load to do that, it failed, the return object''s class is Yaml class, not my prior model class.. Please tell me how can I do to convert yaml to an object as the prior model class, or how can I access the
2012 Dec 03
4
Unnecessary changes when creating facts.yaml
I have set up puppet to create a facts.yaml file for mcollective using the following line: content => inline_template("<%= scope.to_hash.reject { |k,v| k.to_s =~ /(uptime.*|timestamp|.*free|macaddress.*|ipaddress)/ }.to_yaml %>"), However, it is creating a lot of unnecessary changes by reordering the facts in the yaml output as you can see in the diff output between to
2013 Mar 21
0
how to remove changed_attributes from yaml response
Hi, I am using attr_accessor attributes in model class and assigning the values to attr_accessor dynamically in controller. And am sending the data object to display in Yaml format. I am getting the response along with changed_attributes but I don''t want changed_attributes details in my response. build Model code class Test < ActiveRecord::Base attr_accessor: t_1, t_2, t_3, t_4 end
2007 May 29
1
YAML fails when has_one is null
My model has_one :association If I call model.to_yaml (or y model) in the console, and the association is nil, I get a yaml error. Anyone else get this? Is this a confirmed bug? --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to
2007 Oct 07
1
How to store a Mechanize object in the database?
Hi, I am trying to save a Mechanize object in database (using a Rails Model). But the save operation throws a TypeError Considering that "agent" is an instance of a Rails Model and "user" is defined as a "text" type in the Model. irb(main):039:0> agent.user = WWW::Mechanize.new #<WWW::Mechanize:0xb71295f0 @follow_meta_refresh=false, @key=nil,
2007 Apr 12
0
dumping data to yaml in specs
I''m wondering whether I could dump out an object to yaml if a certain spec fails. I believe you can do this sort of thing in test unit. E.g.: hash_one.should == hash_two if_failed? hash_two.to_yaml Scott
2011 Mar 29
0
Issue / code smell in AssociationProxy
I came across an issue in my code and after a hard debug session I found something that smells. First the context of my issue. I have a AR object that has a polymorphic belongs_to currently tied to nothing, I want to dump it to YAML. record.to_yaml This raises the following exception: TypeError: wrong argument type nil (expected Data) from
2012 Dec 14
11
Puppet and Mcollective yaml file changing when it shouldn't
Has anyone else ran into this? debug: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content: Executing ''diff -u /var/tmp/facts.yaml /tmp/puppet-file20121214-13448-933j3r-0'' notice: /Stage[main]/Mcollective/File[/var/tmp/facts.yaml]/content: --- /var/tmp/facts.yaml 2012-12-14 00:53:20.000000000 +0000 +++ /tmp/puppet-file20121214-13448-933j3r-0 2012-12-14
2016 Jul 29
2
Weighting Schemes: Implementing Piv+ Normalization
> `ptr` is, if I inferred correctly, a `const char *`. (I'm not sure, > because I don't know why you're incrementing it. Please push your code > to github if you need further help so people can see the entire > context of your changes.) I've pushed all the changes I made so far https://github.com/xapian/xapian/compare/master...ivmarkp:piv+?diff=split&name=piv%2B
2006 Jun 23
0
to_yaml problem with option hash
Hi, I''m trying to make a fixture for testing with a serialized column. In the YAML fixture I''m trying to fill the serialized column with the to_yaml function. But I keep getting the ''---'' separator, which I don''t want because it is only a ''partial'' yaml fill. According to the documentation to_yaml takes a hash of options, so
2018 Mar 20
0
MIR YAML deserialisation failure
Hello Valentin, To generate a mir test case i think the process is to first create an IR file by passing '-S -emit-llvm' to clang, then you can feed that file into llc and use stop-before to get the mir just before the if-converter pass, eg: `llc -stop-before=if-converter -simplify-mir -o test.mir test.ll`. Also there is a MIR language reference: https://llvm.org/docs/MIRLangRef.html
2018 Mar 19
2
MIR YAML deserialisation failure
Hello, I am trying to isolate an assertion failure in if-converter (on PPC) and I generated a textual debuglog with: ``` LLVM_ARGS=-print-before-all -print-module-scope -filter-print-funcs=japi1__require_7687 ``` and after splicing out the the MIR before the if-converter pass I would like to run `llc -march=ppc64le -run-pass=if-converter input.mir` so that I can start minimising the MIR. This
2018 Mar 20
0
MIR YAML deserialisation failure
Thank you both! I was running into the issue that bugpoint was reducing my test-case into other failures and I hadn't managed yet to find the right point in the Julia pass pipeline to insert the module to reproduce the issue reliably from llc and that's why I started looking at using the MIR. I will go back at looking at the pass pipeline and the IR and get a reproducer that way!
2011 May 06
3
Reading Yaml files and getting an 'uninitialized constant ActionView::CompiledTemplates' Error
Want to load a configuration from a yaml file ala config/database.yml. I am following http://blog.innovativethought.net/2009/01/02/making-configuration-files-with-yaml-revised/ but, I am getting uninitialized constant ActionView::CompiledTemplates::DOMAIN_CONFIG from rails. I''ve documented my code to make this simpler. I''m running Rails 3.0.7 I know isn''t the
2018 Mar 20
2
MIR YAML deserialisation failure
Valentin, in terms of limitations as Sean pointed out, an important one is that .mir doesn't have MachineFunctionInfo which may result in failure on accesses to global variables due to use of register X2. The verifier considers it an undefined register. Also, it's probably easier to reduce test cases using bugpoint starting from an IR test case. With the code you provided, I get a
2016 Apr 03
0
[PATCH v2 4/5] appliance: Added filesystem_walk command
The filesystem_walk command is the appliance's counterpart of the daemon's internal_filesystem_walk command. It writes the daemon's command output on a temporary file and parses it, deserialising the XDR formatted tsk_dirent structs. It returns to the caller the list of tsk_dirent structs generated by the internal_filesystem_walk command. Signed-off-by: Matteo Cafasso <noxdafox
2006 Apr 20
5
Mystified by ActiveRecord.serialize
I''m either missing a step, confused or seeing some odd behavior with ActiveRecord''s serialize feature. When I load an ActiveRecord object from the database, my serialized attribute is a YAML::Object, not the original object. My code is based on an example of this capability in the "Agile Web Dev. w/ Rails" book (p. 196). In create.sql: <code> create table
2010 Jul 17
1
not able to find to_yaml definition
I am looking at rails edge source code. I am able to do puts User.find.to_yaml However I am not able to find piece of code where ''def to_yaml'' is. How this to_yaml serialization is working? can fully understand how to_json and to_xml is working but to_yaml beats me. Thanks -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: