Sha256: 8397d9144f8f40dcd54345a1259ba07ddeb5aa97f3a89c6728b1b687a8368172

Contents?: true

Size: 473 Bytes

Versions: 13

Compression:

Stored size: 473 Bytes

Contents

require "slop"

class Cranium::CommandLineOptions

  def initialize(arguments)
    @arguments = Slop.parse(arguments, autocreate: true).to_hash
  end



  def cranium_arguments
    @cranium_arguments ||= Hash[arguments.map { |k, v| [$1.to_sym, v] if k.to_s =~ /\Acranium\-(.*)/ }.compact]
  end



  def load_arguments
    @load_arguments ||= Hash[arguments.map { |k, v| [k, v] unless k.to_s =~ /\Acranium\-(.*)/ }.compact]
  end



  private

  attr_reader :arguments

end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
cranium-0.8.1 lib/cranium/command_line_options.rb
cranium-0.8 lib/cranium/command_line_options.rb
cranium-0.7 lib/cranium/command_line_options.rb
cranium-0.6.1 lib/cranium/command_line_options.rb
cranium-0.5 lib/cranium/command_line_options.rb
cranium-0.4.3 lib/cranium/command_line_options.rb
cranium-0.4.2 lib/cranium/command_line_options.rb
cranium-0.4.1 lib/cranium/command_line_options.rb
cranium-0.4 lib/cranium/command_line_options.rb
cranium-0.3.1 lib/cranium/command_line_options.rb
cranium-0.3.0 lib/cranium/command_line_options.rb
cranium-0.2.1 lib/cranium/command_line_options.rb
cranium-0.2.0 lib/cranium/command_line_options.rb