Sha256: acfab347aef3f1afdeef7225ea47274f7c859ee622b68c061def285709d53096

Contents?: true

Size: 538 Bytes

Versions: 2

Compression:

Stored size: 538 Bytes

Contents

require 'commands/new_command'
require 'commands/build_command'
require 'commands/tweet_command'

class Ignoramos
  def initialize(args = [])
    command(args).execute
  end

  def command(args)
    cmd = args[0] unless args.empty?

    if cmd == 'new'
      NewCommand.new(args[1])
    elsif cmd == 'build'
      BuildCommand.new
    elsif cmd == 'tweet'
      TweetCommand.new(args[1])
    else
      NilCommand.new
    end
  end

  NilCommand = Struct.new(:args) do
    def execute
      puts 'command not supported'
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ignoramos-1.0.1 lib/ignoramos.rb
ignoramos-1.0.0 lib/ignoramos.rb