Module: ActiveYaml::Aliases::ClassMethods

Defined in:
lib/active_yaml/aliases.rb

Instance Method Summary collapse

Instance Method Details

#insert(record) ⇒ Object



12
13
14
# File 'lib/active_yaml/aliases.rb', line 12

def insert(record)
  super if record.attributes.present?
end

#raw_dataObject



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/active_yaml/aliases.rb', line 16

def raw_data
  d = super
  if d.kind_of?(Array)
    d.reject do |h|
      h.keys.any? { |k| k.match(ALIAS_KEY_REGEXP) }
    end
  else
    d.reject do |k, v|
      v.kind_of?(Hash) && k.match(ALIAS_KEY_REGEXP)
    end
  end
end