public
Created

Gist #9 For "Functional Programming Techniques With Ruby: Part I"

  • Download Gist
gist_9_functional_ruby.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13
class CssBlock
 
# ...
 
def to_s
serialised_properties = self.properties.inject([]) do |acc, (k, v)|
acc + ["#{k}: #{v}"]
end
 
"#{self.selector} { #{serialised_properties.join("; ") } }"
end
 
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.