From b1568bbf24228dc1fd719e697f4b29b616e4d9bb Mon Sep 17 00:00:00 2001 From: Guillaume DOTT Date: Tue, 3 Sep 2013 17:01:22 +0200 Subject: [PATCH] Add to_hayes method to some basic classes --- lib/biju/to_hayes.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 lib/biju/to_hayes.rb diff --git a/lib/biju/to_hayes.rb b/lib/biju/to_hayes.rb new file mode 100644 index 0000000..28bc8aa --- /dev/null +++ b/lib/biju/to_hayes.rb @@ -0,0 +1,19 @@ +class Object + def to_hayes; "\"#{self.to_s}\""; end +end + +class Fixnum + def to_hayes; self.to_s; end +end + +class TrueClass + def to_hayes; '1'; end +end + +class FalseClass + def to_hayes; '0'; end +end + +class Array + def to_hayes; self.map(&:to_hayes).join(','); end +end