Sha256: 74e371bd8dde6895848e1661133cae3a6994f0581cfc2554605494c04e56a1d2

Contents?: true

Size: 557 Bytes

Versions: 1

Compression:

Stored size: 557 Bytes

Contents

require "demisyn/version"

module Demisyn
  class << self
    def lonely_operator?
      major, minor, _ = RUBY_VERSION.split('.')
      major.to_i.>=(2) && minor.to_i.>=(3)
    end
  end

  refine String do
    def ~()
      eval gsub(/ /, ".")
    end 

    case Demisyn.send :lonely_operator?
    when true
      def -@
        eval gsub(/ /, "&.")
      end
    end
  end

  refine Array do
    def ~()
      eval join(".") 
    end

    case Demisyn.send :lonely_operator?
    when true
      def -@
        eval join("&.")
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
demisyn-0.2.0 lib/demisyn.rb