Sha256: 6785246a35282c4ec3a4fbff93ccb3b01321c0adfdd7d7a87859652157460a02

Contents?: true

Size: 554 Bytes

Versions: 1

Compression:

Stored size: 554 Bytes

Contents

module Supa
  class Command
    def initialize(context:, tree:, name:, options: {}, &block)
      @context = context
      @tree = tree
      @name = name
      @options = options
      @block = block
    end

    def represent
      raise NotImplementedError
    end

    private
    attr_reader :context, :tree, :name, :options, :block

    def get_value
      case options[:getter]
      when Proc
        context.instance_exec(&options[:getter])
      when Hash
        context[name]
      else
        context.send(name)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
supa-0.1.3 lib/supa/command.rb