Class: Hash

Inherits:
Object show all
Defined in:
lib/fOOrth/library/hash_library.rb,
lib/fOOrth/library/clone_library.rb,
lib/fOOrth/library/formatting/hash.rb

Overview

  • library/formatting/hash.rb - Hash support for displaying data formatted neatly.

Instance Method Summary collapse

Instance Method Details

#extract_method_names(search_type = :no_stubs) ⇒ Object

A helper method to extract non-stub method names from a method hash.



206
207
208
209
210
211
# File 'lib/fOOrth/library/hash_library.rb', line 206

def extract_method_names(search_type = :no_stubs)
  search_value = (search_type == :stubs)
  get_all = (search_type == :all)
  mkeys = self.keys.select {|key| get_all || search_value == self[key].has_tag?(:stub)  }
  mkeys.collect {|key| XfOOrth::SymbolMap.unmap(key) || '?error?' }
end

#foorth_format_bullets(page_width) ⇒ Object

Convert the array to strings with bullet points.
Returns

  • A string.



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/fOOrth/library/formatting/hash.rb', line 16

def foorth_format_bullets(page_width)
  return "" if empty?

  builder = XfOOrth::BulletPoints.new(page_width)

  self.each do |pair|
    builder.add(*pair)
  end

  builder.render.join("\n").freeze
end

#full_clone_excludeObject

The full clone data member clone exclusion control



66
67
68
69
70
# File 'lib/fOOrth/library/clone_library.rb', line 66

def full_clone_exclude
  vm = Thread.current[:vm]
  self.foorth_exclude(vm)
  vm.pop
end

#puts_foorth_bullets(page_width) ⇒ Object

Print out the array as bullet points.



9
10
11
# File 'lib/fOOrth/library/formatting/hash.rb', line 9

def puts_foorth_bullets(page_width)
  puts foorth_format_bullets(page_width)
end