Class: Argstring::Arguments

Inherits:
Object
  • Object
show all
Defined in:
lib/argstring/models/arguments.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(valid:, errors:, all:, positional:, named:, flags:, position:, name:, flag:) ⇒ Arguments

Returns a new instance of Arguments.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/argstring/models/arguments.rb', line 8

def initialize(valid:, errors:, all:, positional:, named:, flags:, position:, name:, flag:)
	@valid = valid
	@errors = errors
	@all = all
	@positional = positional
	@named = named
	@flags = flags
	@position = position
	@name = name
	@flag = flag
end

Instance Attribute Details

#allObject (readonly)

Returns the value of attribute all.



5
6
7
# File 'lib/argstring/models/arguments.rb', line 5

def all
  @all
end

#errorsObject (readonly)

Returns the value of attribute errors.



5
6
7
# File 'lib/argstring/models/arguments.rb', line 5

def errors
  @errors
end

#flagObject (readonly)

Returns the value of attribute flag.



6
7
8
# File 'lib/argstring/models/arguments.rb', line 6

def flag
  @flag
end

#flagsObject (readonly)

Returns the value of attribute flags.



5
6
7
# File 'lib/argstring/models/arguments.rb', line 5

def flags
  @flags
end

#nameObject (readonly)

Returns the value of attribute name.



6
7
8
# File 'lib/argstring/models/arguments.rb', line 6

def name
  @name
end

#namedObject (readonly)

Returns the value of attribute named.



5
6
7
# File 'lib/argstring/models/arguments.rb', line 5

def named
  @named
end

#positionObject (readonly)

Returns the value of attribute position.



6
7
8
# File 'lib/argstring/models/arguments.rb', line 6

def position
  @position
end

#positionalObject (readonly)

Returns the value of attribute positional.



5
6
7
# File 'lib/argstring/models/arguments.rb', line 5

def positional
  @positional
end

#validObject (readonly)

Returns the value of attribute valid.



5
6
7
# File 'lib/argstring/models/arguments.rb', line 5

def valid
  @valid
end

Instance Method Details

#error_messagesObject

Human-readable errors



25
26
27
# File 'lib/argstring/models/arguments.rb', line 25

def error_messages
	@errors.map(&:to_s)
end

#valid?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/argstring/models/arguments.rb', line 20

def valid?
	@valid
end