Sha256: 8a56e321fa269013384cc1096f7b66c701f877cf0c0f25223cccabdbdb8728d9

Contents?: true

Size: 1.09 KB

Versions: 1

Compression:

Stored size: 1.09 KB

Contents

module Luruju

  module JudeApi
    
    class JudeBase
      
      attr_writer :tagged
      
      def tagged
        return @tagged if @tagged
        @tagged = HashWithIndifferentAccess.new
        tagged_values.each {|x| @tagged[x.key.to_sym] = x.value}
        @tagged
      end
      
      def inspect
        "<#{self.class}: id=#{self.id}>"
      end
      
    end
    
    module JudeNamedElementAddMethod
      def inspect
        "<#{self.class}: name=#{self.name} id=#{self.id}>"
      end
    end
    
    module JudeErAttributeAddMethod
      def constraint constraint_name
        constraints.find{|x|constraint_name == x.name}
      end
    end

  end

end

class Class
  
  alias :include_except_luruju :include
  
  def include included
    unless self.ancestors.include?(Luruju::JudeApi::JudeBase)
      return include_except_luruju(included)
    end
    if Luruju::JudeApi.constants.include? "#{self.name}AddMethod".split("::").last
      included.send :include, eval("#{self.name}AddMethod")
    end
    include_except_luruju included
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
luruju-0.1.0 lib/luruju/jude_api/add_method.rb