Sha256: e12b211c8a1b9360f3136609a154972c05d3d7b0a3d22725e048d3e55715d7f8

Contents?: true

Size: 790 Bytes

Versions: 2

Compression:

Stored size: 790 Bytes

Contents

module Mayl
  module Commands
    # Public: The Cd command navigates through YAML namespaces.
    #
    # Example
    # 
    #   command = Ls.new(env)
    #   command.execute
    #
    class Ls
      # Public: Initializes a new Cd command.
      #
      # env  - the global environment
      def initialize(env)
        @env = env
      end

      # Public: Adds the path to the namespace.
      #
      # Returns nil.
      def execute
        locales.map { |locale|
          locale.peek(@env.namespace)
        }.flatten.uniq.each do |option|
          print "#{option} "
        end
        nil
      end

      #######
      private
      #######

      # Public: Returns an Array with the locales of the environment.
      def locales
        @env.locales
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mayl-0.1.0 lib/mayl/commands/ls.rb
mayl-0.0.1 lib/mayl/commands/ls.rb