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