Source

socionic / lib / socionic / type.rb

Full commit
require 'socionic/relation'
module Socionic
    class Type
        include SocionicMixin
        attr_reader :value, :abbr, :alias
        def initialize(a,b,c,d)
            @value = a.value * b.value * c.value * d.value
            @abbr = "#{a.abbr}#{b.abbr}#{c.abbr}#{d.abbr}"
            @alias = ''
        end
        def to_s
            res = "#{@value.to_s 2}: #{@abbr}"
            res += " - #{@alias}" unless @alias.empty?
            res
        end
        def &(other)
            value & other.value
        end
        def +(other)
            Socionic::Relation.new(self, other)
        end
    end
end