class GitCommander::Command::Option
@abstract Wraps [Command] arguments, flags, and switches in a generic
object to normalize their representation in the context of a [Command].
Attributes
default[R]
description[R]
name[R]
value[W]
Public Class Methods
new(name:, default: nil, description: nil, value: nil)
click to toggle source
Creates a [Option] object.
@param name [String, Symbol] the name of the option, these are unique per [Command] @param default [anything] the default value the option should have @param description [String] a description of the option for display in
the [Command]'s help text
@param value [anything] a value for the option
# File lib/git_commander/command/option.rb, line 19 def initialize(name:, default: nil, description: nil, value: nil) @name = name.to_sym @default = default @description = description @value = value end
Public Instance Methods
==(other)
click to toggle source
# File lib/git_commander/command/option.rb, line 30 def ==(other) other.class == self.class && other.name == name && other.default == default && other.description == description end
Also aliased as: eql?
to_h()
click to toggle source
# File lib/git_commander/command/option.rb, line 38 def to_h { name => value } end
value()
click to toggle source
# File lib/git_commander/command/option.rb, line 26 def value @value || @default end