Class: Jekyll::Compose::ArgParser
- Inherits:
-
Object
- Object
- Jekyll::Compose::ArgParser
show all
- Defined in:
- lib/jekyll-compose/arg_parser.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(args, options, config = nil) ⇒ ArgParser
TODO: Remove ‘nil` parameter in v1.0
9
10
11
12
13
|
# File 'lib/jekyll-compose/arg_parser.rb', line 9
def initialize(args, options, config = nil)
@args = args
@options = options
@config = config || Jekyll.configuration(options)
end
|
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
6
7
8
|
# File 'lib/jekyll-compose/arg_parser.rb', line 6
def args
@args
end
|
#config ⇒ Object
Returns the value of attribute config.
6
7
8
|
# File 'lib/jekyll-compose/arg_parser.rb', line 6
def config
@config
end
|
#options ⇒ Object
Returns the value of attribute options.
6
7
8
|
# File 'lib/jekyll-compose/arg_parser.rb', line 6
def options
@options
end
|
Instance Method Details
#force? ⇒ Boolean
31
32
33
|
# File 'lib/jekyll-compose/arg_parser.rb', line 31
def force?
!!options["force"]
end
|
#source ⇒ Object
39
40
41
42
|
# File 'lib/jekyll-compose/arg_parser.rb', line 39
def source
File.join(config["source"], config["collections_dir"])
.gsub(%r!^#{Regexp.quote(Dir.pwd)}/*!, "")
end
|
#title ⇒ Object
27
28
29
|
# File 'lib/jekyll-compose/arg_parser.rb', line 27
def title
args.join " "
end
|
#type ⇒ Object
19
20
21
|
# File 'lib/jekyll-compose/arg_parser.rb', line 19
def type
options["extension"] || Jekyll::Compose::DEFAULT_TYPE
end
|
#validate! ⇒ Object
15
16
17
|
# File 'lib/jekyll-compose/arg_parser.rb', line 15
def validate!
raise ArgumentError, "You must specify a name." if args.empty?
end
|