Module: CKick::Hashable

Included in:
Dependencies, Project, SubDirectory, Target
Defined in:
lib/ckick/hashable.rb

Instance Method Summary collapse

Instance Method Details

#to_hashObject



10
11
12
13
14
15
16
# File 'lib/ckick/hashable.rb', line 10

def to_hash
  a = {}
  instance_variables_as_key_values.each do |name, obj|
    a[name] = object_value(obj)
  end
  a
end

#to_no_empty_value_hashObject



18
19
20
21
22
23
24
25
26
# File 'lib/ckick/hashable.rb', line 18

def to_no_empty_value_hash
  a = {}
  instance_variables_as_key_values.each do |name, obj|
    if !obj.respond_to?(:empty?) || (obj.respond_to?(:empty?) && !obj.empty?)
      a[name] = object_value(obj)
    end
  end
  a
end