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) ⇒ ArgParser
Returns a new instance of ArgParser.
5
6
7
8
9
|
# File 'lib/jekyll-compose/arg_parser.rb', line 5
def initialize(args, options)
@args = args
@options = options
@config = Jekyll.configuration(options)
end
|
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
4
5
6
|
# File 'lib/jekyll-compose/arg_parser.rb', line 4
def args
@args
end
|
#config ⇒ Object
Returns the value of attribute config.
4
5
6
|
# File 'lib/jekyll-compose/arg_parser.rb', line 4
def config
@config
end
|
#options ⇒ Object
Returns the value of attribute options.
4
5
6
|
# File 'lib/jekyll-compose/arg_parser.rb', line 4
def options
@options
end
|
Instance Method Details
#force? ⇒ Boolean
27
28
29
|
# File 'lib/jekyll-compose/arg_parser.rb', line 27
def force?
!!options["force"]
end
|
#layout ⇒ Object
19
20
21
|
# File 'lib/jekyll-compose/arg_parser.rb', line 19
def layout
options["layout"] || Jekyll::Compose::DEFAULT_LAYOUT
end
|
#source ⇒ Object
31
32
33
|
# File 'lib/jekyll-compose/arg_parser.rb', line 31
def source
config["source"].gsub(%r!^#{Regexp.quote(Dir.pwd)}!, "")
end
|
#title ⇒ Object
23
24
25
|
# File 'lib/jekyll-compose/arg_parser.rb', line 23
def title
args.join " "
end
|
#type ⇒ Object
15
16
17
|
# File 'lib/jekyll-compose/arg_parser.rb', line 15
def type
options["extension"] || Jekyll::Compose::DEFAULT_TYPE
end
|
#validate! ⇒ Object
11
12
13
|
# File 'lib/jekyll-compose/arg_parser.rb', line 11
def validate!
raise ArgumentError, "You must specify a name." if args.empty?
end
|