Sha256: f7dc3880bdcb26e895e52f891d99289ed27e6d3c0bc801bbff6de38fba87f4da

Contents?: true

Size: 679 Bytes

Versions: 4

Compression:

Stored size: 679 Bytes

Contents

class Code
  class Object
    class Argument < ::Code::Object
      attr_reader :value, :name, :splat, :keyword_splat, :block

      def initialize(
        value,
        name: nil,
        splat: false,
        keyword_splat: false,
        block: false
      )
        @value = value
        @name = name
        @splat = !!splat
        @keyword_splat = !!keyword_splat
        @block = !!block
      end

      def regular?
        !name
      end

      def keyword?
        !regular?
      end

      def name_value
        [name, value]
      end

      def to_s
        "<Argument #{value.inspect}>"
      end

      def inspect
        to_s
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
template-ruby-0.3.1 lib/code/object/argument.rb
code-ruby-0.3.1 lib/code/object/argument.rb
template-ruby-0.3.0 lib/code/object/argument.rb
code-ruby-0.3.0 lib/code/object/argument.rb