Dalla Rosa

Posts tagged ruby

0 notes &

Dynamically adding attribute accessors in Ruby

A simple way for adding attribute accessors to a class dynamically:

class MyClass
  def add_attr(name, value)
    self.class.send(:attr_accessor, name)
    instance_variable_set("@#{name}", value)
just call the add_attr method passing the name of the accessor (as a string) and a value that will be assigned to the variable.
You can also turn this in to a module so that you can easily add the functionality to all your classes.
I’m actually using this in a script I made to easily change data in long csv files.
I wanted to be able to convert CSV files into Ruby objects before changing the data, even if the fields change from file to change.
I know some people are gonna say “just use an existing gem or so”, but this is being fun.

Filed under tech ruby programming accessors

0 notes &

plist2ota - Generate OTA Manifests from plists

A friend of mine was in need of a script to automatically generate the OTA Manifests needed to distribute iOS apps internally through the iOS Developer Enterprise License

So I wrote a little Ruby script that uses the plist gem for creating a Ruby Array from the plists information. One limitation I found in the plist gem is that it can’t parse binary plists. Right now I’m working on implementing that in Ruby and see if I can get it added to the gem but, for now, I just added to the package this perl script I found, indicated by this page.

If your plist is a binary one, just convert the plist to XML using the plutil.pl script and then using plist2ota.rb to generate your OTA Manifest. 

The link is here: https://github.com/dallarosa/plist2ota

Requests, issues and sugestions, please use Github’s issues page :)

Filed under plist ota manifest apple ios development tech linux macosx ruby perl

4 notes &

Ruby is accepted as an International Standard

Ruby, the language created by Yuhikiro “Matz” Matsumoto in 1993 has been accepted as and International by the International Standards Organization (ISO) as the ISO/IEC 30170 standard.

The Information technology Promotion Agency (IPA) has developed the draft standard specification document of Ruby and it was registered as the  JIS (Japanese Industrial Standard) X 3017 on 2011.

Since 2008 a working group lead by Ikuo Nakata, professor emeritus of University of Tsukuba, has been working on an international standard for Ruby.

Ruby’s acceptance marks also the first time a language developed in Japan is accepted as an international standard.

Ruby was created in 1993 by Yuhikiro “Matz” Matsumoto with the goal of making programming fun[1]:

"I hope to see Ruby help every programmer in the world to be productive, and to enjoy programming, and to be happy. That is the primary purpose of Ruby language."

My first contact with Ruby was almost 3 years ago, during my Master’s, where many of the students would prefer programming in Ruby, rather than the more well-known perl or python. The reason most fo them gave me is the abundance of documentation in Japanese, as it’s a made in Japan language. (I live in Japan) Under their influence I played a bit with it but nothing really deep. It’ wasn’t until 2010 when I decided to try Rails that I first started to study Ruby more properly. It’s expressiveness and ease of use really stand out. The flexibility given by the fact that everything is an object and the meta-programming features make Ruby a great language for fast prototyping.

This announcement comes together with Matz receiving the FSF’s 2011 Free Software Award.

Congratulations Ruby, congratulations Matz!

Here’s the original announcement, from the IPA (in Japanese):


Filed under tech ruby programming language