Sha256: d8c3b20eedd4215eb6f6b1e3b00d8ffe9dc34a099cf083647c7ac47c264690ea
Contents?: true
Size: 974 Bytes
Versions: 1
Compression:
Stored size: 974 Bytes
Contents
require 'active_record' require 'active_support/core_ext' require 'set_builder/traits' require 'set_builder/modifiers' require 'set_builder/value_map' require 'set_builder/set' module SetBuilder def self.extended(base) base.instance_variable_set("@traits", SetBuilder::Traits.new) base.send(:include, SetBuilder::Modifiers) end attr_reader :traits def modifiers traits.modifiers end def that_belong_to(set) SetBuilder::Set.new(self, set) end protected def trait(*args, &block) part_of_speech = get_part_of_speech(args.shift) name = args.shift traits << Trait.new(name, part_of_speech, *args, &block) end def get_part_of_speech(arg) case arg when :is, :are, :reflexive :reflexive when nil, :active :active when :was, :were, :passive :passive when :has, :have, :perfect :perfect when :whose, :noun :noun end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
set_builder-1.0.2 | lib/set_builder.rb |