Class: Jekyll::Commands::ComposeCommand::ComposeCommandArgParser

Inherits:
Jekyll::Compose::ArgParser show all
Defined in:
lib/jekyll/commands/compose.rb

Instance Attribute Summary

Attributes inherited from Jekyll::Compose::ArgParser

#args, #config, #options

Instance Method Summary collapse

Methods inherited from Jekyll::Compose::ArgParser

#force?, #initialize, #layout, #source, #timestamp_format, #title, #type

Constructor Details

This class inherits a constructor from Jekyll::Compose::ArgParser

Instance Method Details

#collectionObject



57
58
59
60
61
62
63
64
65
# File 'lib/jekyll/commands/compose.rb', line 57

def collection
  if (coll = options["collection"])
    coll
  elsif options["draft"]
    "drafts"
  else
    "posts"
  end
end

#dateObject



53
54
55
# File 'lib/jekyll/commands/compose.rb', line 53

def date
  @date ||= options["date"] ? Date.parse(options["date"]) : Time.now
end

#validate!Object



45
46
47
48
49
50
51
# File 'lib/jekyll/commands/compose.rb', line 45

def validate!
  if options.values_at("post", "draft", "collection").compact.length > 1
    raise ArgumentError, "You can only specify one of --post, --draft, or --collection COLLECTION."
  end

  super
end