Sha256: 70aa3ac73a5031dd35480520375df45d9799933d507f0e9aeef7161fc893e181

Contents?: true

Size: 711 Bytes

Versions: 8

Compression:

Stored size: 711 Bytes

Contents

require_relative 'config_command'

module WhirledPeas
  module Command
    class FrameCommand < ConfigCommand
      private

      attr_reader :frame, :frame_args

      def validate!
        super
        frame = args.shift
        raw_args = args.shift
        if frame.nil?
          @error_text = "#{command_name} requires a frame name"
        else
          @frame = frame
          @frame_args = {}
          return if raw_args.nil?

          require 'json'

          JSON.parse(raw_args || '{}').each do |key, value|
            @frame_args[key.to_sym] = value
          end
        end
      end

      def options_usage
        "#{super} <frame> [args as a JSON string]"
      end
    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
whirled_peas-0.13.0 lib/whirled_peas/command/frame_command.rb
whirled_peas-0.12.0 lib/whirled_peas/command/frame_command.rb
whirled_peas-0.11.1 lib/whirled_peas/command/frame_command.rb
whirled_peas-0.11.0 lib/whirled_peas/command/frame_command.rb
whirled_peas-0.10.0 lib/whirled_peas/command/frame_command.rb
whirled_peas-0.9.1 lib/whirled_peas/command/frame_command.rb
whirled_peas-0.9.0 lib/whirled_peas/command/frame_command.rb
whirled_peas-0.8.0 lib/whirled_peas/command/frame_command.rb