Class: ExAequo::Args

Inherits:
Object
  • Object
show all
Defined in:
lib/ex_aequo/args.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#missingObject (readonly)

Returns the value of attribute missing.



8
9
10
# File 'lib/ex_aequo/args.rb', line 8

def missing
  @missing
end

#positionalsObject (readonly)

Returns the value of attribute positionals.



8
9
10
# File 'lib/ex_aequo/args.rb', line 8

def positionals
  @positionals
end

#superflousObject (readonly)

Returns the value of attribute superflous.



8
9
10
# File 'lib/ex_aequo/args.rb', line 8

def superflous
  @superflous
end

Instance Method Details

#add_illegal_kwd(kwd) ⇒ Object



10
11
12
# File 'lib/ex_aequo/args.rb', line 10

def add_illegal_kwd(kwd)
  errors << ["Illegal kwd #{kwd}"]
end

#add_kwd(kwd, value) ⇒ Object



14
15
16
17
18
# File 'lib/ex_aequo/args.rb', line 14

def add_kwd(kwd, value)
  # Constraint Checks would go here
  @keywords[kwd.to_sym] = value
  self
end

#add_positional(arg) ⇒ Object



20
21
22
23
# File 'lib/ex_aequo/args.rb', line 20

def add_positional(arg)
  positionals << arg
  self
end

#errorsObject



25
26
27
# File 'lib/ex_aequo/args.rb', line 25

def errors
  @__errors__ ||= []
end

#keywordsObject



29
30
31
# File 'lib/ex_aequo/args.rb', line 29

def keywords
  MyStruct.new(@keywords)
end

#ok?Boolean

Returns:

  • (Boolean)


33
34
35
# File 'lib/ex_aequo/args.rb', line 33

def ok?
  missing.empty? && errors.empty?
end

#set_flag(flag) ⇒ Object



37
38
39
40
# File 'lib/ex_aequo/args.rb', line 37

def set_flag(flag)
  @keywords[flag.to_sym] = true
  self
end