Class: Hash

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

Overview

  • Runtime clone library support in Hash.

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.



198
199
200
201
202
203
# File 'lib/fOOrth/library/hash_library.rb', line 198

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_bulletize(page_width) ⇒ Object

Convert the hash to strings with bullet points.

  • An array of arrays of strings



112
113
114
115
116
117
118
119
120
# File 'lib/fOOrth/library/formatting/bullets.rb', line 112

def foorth_bulletize(page_width)
  builder = XfOOrth::BulletPoints.new(page_width)

  self.each do |key, value|
    builder.add(key, *value.in_array)
  end

  builder.render
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 hash as bullet points.



105
106
107
# File 'lib/fOOrth/library/formatting/bullets.rb', line 105

def puts_foorth_bullets(page_width)
  puts foorth_bulletize(page_width)
end