Class: Sexp

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

Instance Method Summary collapse

Instance Method Details

#all_structural_subhashesObject



299
300
301
302
303
304
305
# File 'lib/flay.rb', line 299

def all_structural_subhashes
  hashes = []
  self.deep_each do |node|
    hashes << node.structural_hash
  end
  hashes
end

#deep_each(&block) ⇒ Object



307
308
309
310
311
312
# File 'lib/flay.rb', line 307

def deep_each(&block)
  self.each_sexp do |sexp|
    block[sexp]
    sexp.deep_each(&block)
  end
end

#each_sexpObject



314
315
316
317
318
319
320
# File 'lib/flay.rb', line 314

def each_sexp
  self.each do |sexp|
    next unless Sexp === sexp

    yield sexp
  end
end

#structural_hashObject



295
296
297
# File 'lib/flay.rb', line 295

def structural_hash
  @structural_hash ||= self.structure.hash
end