Class: Surveyor::Unparser

Inherits:
Object
  • Object
show all
Defined in:
lib/surveyor/unparser.rb

Class Method Summary collapse

Class Method Details

.hash_diff(h1, h2) ⇒ Object

cribbed from rails source: apidock.com/rails/v3.2.13/Hash/diff



11
12
13
# File 'lib/surveyor/unparser.rb', line 11

def self.hash_diff(h1, h2)
  h1.dup.delete_if { |k, v| h2[k] == v }.merge!(h2.dup.delete_if { |k, v| h1.has_key?(k) })
end

.unparse(survey) ⇒ Object

Class methods



5
6
7
8
# File 'lib/surveyor/unparser.rb', line 5

def self.unparse(survey)
  survey.unparse(dsl = "")
  dsl
end