Sha256: 4b8b51a05a763b519400d899ecae5a32506ad7b6882f7ae5a24db7044eb92525

Contents?: true

Size: 583 Bytes

Versions: 1

Compression:

Stored size: 583 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 squeeze(' ').gsub(/ /, ".")
    end 

    case Demisyn.send :lonely_operator?
    when true
      def -@
        eval squeeze(' ').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.2 lib/demisyn.rb