Sha256: f1870f51fdde6129c988456c1cd608e2847bdb4b7cedf4709b72d7aee6ce28e0
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
# encoding: UTF-8 module Rosette module Core module Commands # Mixin that handles configuration and validation of a repository name. # Meant to be mixed into the classes in {Rosette::Core::Commands}. # # @example # class MyCommand < Rosette::Core::Commands::Command # include WithRepoName # end # # cmd = MyCommand.new # .set_repo_name('my_repo') # # cmd.repo_name # => "my_repo" # cmd.valid? # => true # # cmd.set_repo_name('non_existent_repo') # cmd.valid? # => false # cmd.messages # => { repo_name: ["Unable to find repo 'non_existent_repo'."] } # # @!attribute [r] repo_name # @return [String] the repository name. module WithRepoName attr_reader :repo_name # Set the repository name. # # @param [String] repo_name The repository name. # @return [self] def set_repo_name(repo_name) @repo_name = repo_name self end protected def self.included(base) if base.respond_to?(:validate) base.validate :repo_name, type: :repo end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rosette-core-1.0.1 | lib/rosette/core/commands/git/with_repo_name.rb |