Class: Jekyll::Compose::MovementArgParser

Inherits:
Object
  • Object
show all
Defined in:
lib/jekyll-compose/movement_arg_parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args, options) ⇒ MovementArgParser

Returns a new instance of MovementArgParser.



5
6
7
8
9
# File 'lib/jekyll-compose/movement_arg_parser.rb', line 5

def initialize(args, options)
  @args = args
  @options = options
  @config = Jekyll.configuration(options)
end

Instance Attribute Details

#argsObject (readonly)

Returns the value of attribute args.



4
5
6
# File 'lib/jekyll-compose/movement_arg_parser.rb', line 4

def args
  @args
end

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/jekyll-compose/movement_arg_parser.rb', line 4

def config
  @config
end

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/jekyll-compose/movement_arg_parser.rb', line 4

def options
  @options
end

Instance Method Details

#pathObject



15
16
17
# File 'lib/jekyll-compose/movement_arg_parser.rb', line 15

def path
  args.join " "
end

#sourceObject



19
20
21
# File 'lib/jekyll-compose/movement_arg_parser.rb', line 19

def source
  source = config["source"].gsub(%r!^#{Regexp.quote(Dir.pwd)}!, "")
end

#validate!Object

Raises:

  • (ArgumentError)


11
12
13
# File 'lib/jekyll-compose/movement_arg_parser.rb', line 11

def validate!
  raise ArgumentError, "You must specify a #{resource_type} path." if args.empty?
end