Class: Bunto::Compose::ArgParser
- Inherits:
-
Object
- Object
- Bunto::Compose::ArgParser
show all
- Defined in:
- lib/bunto-compose/arg_parser.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args, options) ⇒ ArgParser
Returns a new instance of ArgParser.
3
4
5
6
|
# File 'lib/bunto-compose/arg_parser.rb', line 3
def initialize(args, options)
@args = args
@options = options
end
|
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
2
3
4
|
# File 'lib/bunto-compose/arg_parser.rb', line 2
def args
@args
end
|
#options ⇒ Object
Returns the value of attribute options.
2
3
4
|
# File 'lib/bunto-compose/arg_parser.rb', line 2
def options
@options
end
|
Instance Method Details
#force? ⇒ Boolean
24
25
26
|
# File 'lib/bunto-compose/arg_parser.rb', line 24
def force?
!!options["force"]
end
|
#layout ⇒ Object
16
17
18
|
# File 'lib/bunto-compose/arg_parser.rb', line 16
def layout
layout = options["layout"] || Bunto::Compose::DEFAULT_LAYOUT
end
|
#title ⇒ Object
20
21
22
|
# File 'lib/bunto-compose/arg_parser.rb', line 20
def title
args.join ' '
end
|
#type ⇒ Object
12
13
14
|
# File 'lib/bunto-compose/arg_parser.rb', line 12
def type
type = options["extension"] || Bunto::Compose::DEFAULT_TYPE
end
|
#validate! ⇒ Object
8
9
10
|
# File 'lib/bunto-compose/arg_parser.rb', line 8
def validate!
raise ArgumentError.new('You must specify a name.') if args.empty?
end
|