Sha256: d8842e7a1d5dfc4b39622e3300ee00c4f1dd05644217913bf739a5c952e3ec12

Contents?: true

Size: 507 Bytes

Versions: 1

Compression:

Stored size: 507 Bytes

Contents

module Vedeu
  class CommandRepository
    extend Repository

    class << self
      def find_by_input(input)
        return nil if input.nil? || input.empty?
        return by_keypress(input) if input.size == 1
        return by_keyword(input)  if input.size > 1
      end

      def klass
        Command
      end

      private

      def by_keypress(input)
        query(klass, :keypress, input)
      end

      def by_keyword(input)
        query(klass, :keyword, input)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vedeu-0.0.11 lib/vedeu/repository/command_repository.rb