module Traits

Constants

VERSION

Public Class Methods

all() click to toggle source
# File lib/activerecord-traits.rb, line 40
def all
  each_with_object({}) do |traits, memo|
    memo[traits.name] = traits
  end
end
each() { |traits| ... } click to toggle source
# File lib/activerecord-traits.rb, line 36
def each
  active_record_descendants.each { |ar| yield(ar.traits) }
end
each_attribute(&block) click to toggle source
# File lib/activerecord-traits.rb, line 46
def each_attribute(&block)
  each { |traits| traits.attributes.each(&block) }
end
for(obj) click to toggle source
# File lib/activerecord-traits.rb, line 32
def for(obj)
  retrieve_active_record!(obj).traits
end
to_hash() click to toggle source
# File lib/activerecord-traits.rb, line 50
def to_hash
  each_with_object({}) do |traits, memo|
    memo[traits.name] = traits.to_hash
  end
end