Add to_hayes method to some basic classes
This commit is contained in:
parent
404f7d8290
commit
b1568bbf24
19
lib/biju/to_hayes.rb
Normal file
19
lib/biju/to_hayes.rb
Normal file
@ -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
|
Loading…
x
Reference in New Issue
Block a user