Sha256: 69a2fbccc26216355f94eebeafe6ef4e2c36615e83389449f631ab5e2c88f7bd

Contents?: true

Size: 462 Bytes

Versions: 1

Compression:

Stored size: 462 Bytes

Contents

module Bickle
  class Repository
    def initialize(repository_name)
      @repository_name = parse_name(repository_name)
    end

    def name
      @repository_name
    end

    private

    def parse_name(name)
      regex = "[A-Za-z0-9_-]+"

      if name =~ Regexp.new("^#{regex}\/#{regex}$")
        name
      elsif name =~ Regexp.new("^#{regex}$")
        "#{name}/#{name}"
      else
        raise InvalidRepositoryNameError
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bickle-0.0.1 lib/bickle/repository.rb