Sha256: 46a793ecb9a6a0fb890048bfc31c5e0e38c20d63222a7b78d9f3e326ed679f08

Contents?: true

Size: 282 Bytes

Versions: 7

Compression:

Stored size: 282 Bytes

Contents

require 'facets/functor'

class Symbol

  # Convert symbol to string, apply string method and convert
  # back to symbol via a fluent interface.
  #
  #   :HELLO.as_s.downcase  #=> :hello
  #
  def as_s
    Functor.new do |op, *a|
      to_s.send(op, *a).to_sym
    end
  end

end

Version data entries

7 entries across 6 versions & 1 rubygems

Version Path
facets-2.9.3 lib/core/facets/symbol/as_s.rb
facets-2.9.2 lib/core/facets/symbol/as_s.rb
facets-2.9.2 src/core/facets/symbol/as_s.rb
facets-2.9.1 lib/core/facets/symbol/as_s.rb
facets-2.9.0 lib/core/facets/symbol/as_s.rb
facets-2.9.0.pre.2 lib/core/facets/symbol/as_s.rb
facets-2.9.0.pre.1 lib/core/facets/symbol/as_s.rb