yaml

Ruby YAML write without aliases

I am writing data to yaml files from ruby and I frequently get aliases dotted about the file. Things like: - &id001 somekey: somevalue - *id001 In my case I am using the yaml files to aid readability and add names to values in the files as the existing data is just | separated values with no keys. How can I prevent the yaml files ...

Yaml ambiquity; intendation spaces and empty node

I wrote: a: -b -c Parser understood it as: !!map { ? !!str "a" : !!seq [ !!str "b", !!str "c" ] } But I meant: !!map { ? !!str "a" : !!null "" } !!seq [ !!str "b", !!str "c" ] The specification says: The “-”, “?” and “:” characters used to denote block collection entries are perceived by peopl...

RoR: Storing HTML in a File for Later Use

Hi All, In our application we have different themes and each theme has its own default content in the following structure: ROWS COLUMNS CONTENT HTML DATA 1 CONTENT HTML DATA 2 There could be multiple rows, column and content elements. We need to store this data in a file (manually) and then read & dump it ...

i18n on Ruby on Rails, < and > gets replaced by &gt ; &lt ; when not intended

I am creating locale files for internationalization in a rails app, and have a url that I want translated with tags included , for example html.erb <%= t(foo.bar.xxxx) %> yml file foo: bar: xxxx: "xxxx" result &lt ;a href= "/info/index.html"&gt ;xxxx</a&gt ; which breaks my links. I do not have an h on th...

Which recommended Perl modules can serialize Moose objects?

I was usually using Storable with nstore, but now I have a module that has CODE and apparently Storable doesn't like that. I found YAML (and YAML::XS which I can't really get to work). I also experimented a bit with MooseX::Storage without much success. Are there other alternatives? What would you recommend? ...

How to load configuration at startup in rails?

I have some configuration values in a YAML file that needs loaded when my app starts up. The values need to be accessed in a few different places (both in a few models and a few controllers). What is the best way to load, store, and access these? ...

customising the symfony view.yml file

Hi guys, I have a question regarding the view.yml file in Symfony. Basically I would like to be able to include certain javascript SDKs in my layout with the help of the view.yml file like so: first i would add an entry the the corresponding view file: all: load_facebook: true load_twitter: true stylesheets: javascripts: ...

Why do I have to load a Perl class to use its object I deserialize from YAML?

I was trying to serialize some (Moose) objects with YAML -- simply by using YAML's Dump() and Load(). After loading a serialized object, it didn't 'work' until I added a use statement with the original module name. If I don't use use I won't get any error until I try to invoke some object method, then it will croak saying it can't find ...

What are some good alternative serialization formats?

I have used XML in the past, but it is very verbose and clunky. We are currently using YAML, but I am finding that most developers have alot of trouble with the whitespace. Is there a YAML like format that is whitespace insensitive, but not as verbose as XML? ...

Is there a good yaml library for Android?

Is there a java yaml library as good as snakeyaml for Android? (Or is anyone successfully using snakeyaml on Android already?) ...

How to gsub an unicode 0083 with ruby ?

Hi Guys, I have loaded a string from a html.file, and I have writen it to a yaml file with the plugin ya2yaml: - title: 'What a wonderful day!' body: ... # main contents here and I will load the .yml file by YAML::parse_file method. but "\n" in the string will cause load problems, so I tried to gsub all "\n" to "", but the...

Setting environment variables in Rails

I'm trying to make my project OSS, and I'd like to remove any sensitive info from the configs. I'm trying to have ENV['DB_PASS'] = mypassword. Where would I set this? I've tried export DB_PASS=mypassword in my .bashrc file. But that's not working. ...