Sha256: 4dcf9d6d6b51c9c7952908c1bbf2a97aa3ffc69982d68e6b24eaadd1e81fb219

Contents?: true

Size: 805 Bytes

Versions: 3

Compression:

Stored size: 805 Bytes

Contents

require 'compo/branches/leaf'

module Compo
  module Branches
    # A Leaf containing a constant value
    #
    # The value can be retrieved using #value.
    class Constant < Leaf
      # Initialises the Constant
      #
      # @api public
      # @example  Initialising a Constant with a given value.
      #   Constant.new(:value)
      #
      # @param value [Object] The value of the constant.
      #
      def initialize(value)
        super()
        @value = value
      end

      # Returns the current value of this Constant
      #
      # @api public
      # @example  Retrieving a Constant's value.
      #   const = Constant.new(:spoon)
      #   const.value
      #   #=> :spoon
      #
      # @return [Object]  The Constant's internal value.
      attr_reader :value
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
compo-0.5.1 lib/compo/branches/constant.rb
compo-0.5.0 lib/compo/branches/constant.rb
compo-0.4.0 lib/compo/branches/constant.rb