Sha256: 802f4ca25fa655bc3242b0dbdd4eb2d5a31b9c45c39584ab3d95668f840e00e3

Contents?: true

Size: 578 Bytes

Versions: 2

Compression:

Stored size: 578 Bytes

Contents

#!/usr/bin/env ruby
require 'exalted_math/node/node'
module ExaltedMath
  class Node
    class Named < Node
      attr_reader :name
      def initialize(name)
        @name = name
      end

      def constant?
        false
      end

      def value(context={})
        context.fetch(name) { raise ContextError, name }
      end

      def ==(o)
        return false unless self.class === o
        self.name == o.name
      end

      def valid?(stats)
        stats.include?(name)
      end
    end

    class Stat < Named
    end

    class Spec < Named
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exalted_math-0.2.1 lib/exalted_math/node/named.rb
exalted_math-0.2.0 lib/exalted_math/node/named.rb