Sha256: d08564e358660c0a3203ca3d223ffa1283f71154299be9b907f4c202b3eaa52d
Contents?: true
Size: 636 Bytes
Versions: 1
Compression:
Stored size: 636 Bytes
Contents
module RenderCow module RenderCowPatch def render(options = {}, args = {}) options[:plain] = cowspeach(options).then { RenderCow.moo(_1, character) } if character?(options) super end private def character(options = {}) options[:cow] = options.delete(:cowsay) if options.key?(:cowsay) @character ||= options.detect do |key, _value| RenderCow.characters.find { _1 == key } end&.first end def character?(options) return unless options.is_a?(Hash) character(options).present? end def cowspeach(options = {}) options[character] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
render_cow-0.4.1 | lib/render_cow/render_cow_patch.rb |