Sha256: 4c3ea1641aa2ebcabc63593041fc4d8761e0d4298ee674b1d9a511a6726c555e

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 Bytes

Contents

class Repo
  attr_accessor :username, :name
  
  def initialize(repo)
    if repo.is_a?(String)
      repo = repo.split("/")
      @name = repo.pop
      @username = repo.pop
    elsif repo.is_a?(Repo)
      @username = repo.username
      @name = repo.name
    elsif repo.is_a?(Hash)
      @name = repo[:repo] ||= repo[:name] 
      @username = repo[:username] ||= repo[:user] ||= repo[:owner]
    end
  end
  
  def slug
    "#{@username}/#{@name}"
  end
  
  def user
    @username
  end
  
  def repo
    @name
  end
  
  def user=(val)
    @username = val
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
octopussy-0.0.1 lib/octopussy/repo.rb