Class: Array

Inherits:
Object show all
Includes:
Diff, Shuffle
Defined in:
lib/shuffle.rb,
lib/diff.rb,
lib/choose.rb,
lib/r_path.rb,
lib/sym_tbl_gsub.rb,
lib/yaml/transform.rb,
lib/commands/helpers.rb

Overview

:nodoc:

Instance Method Summary collapse

Methods included from Shuffle

#shuffle, #shuffle!, #swap, #swap!

Methods included from Diff

#diff, #gen_diff, #no_diff?

Instance Method Details

#choose(limit = nil, generator = nil) ⇒ Object



49
50
51
52
53
54
55
56
# File 'lib/choose.rb', line 49

def choose ( limit=nil, generator=nil )
  n = size

  # Out of limits: limit > size (FIXME warn)
  limit = n if limit.nil? or limit > n

  self[limit.choose(generator)]
end

#each_pairObject



61
62
63
64
65
# File 'lib/diff.rb', line 61

def each_pair
  for i in 0...length do
    yield(i, self[i])
  end
end

#has_index?(i) ⇒ Boolean Also known as: has_key?

Returns:

  • (Boolean)


67
68
69
# File 'lib/diff.rb', line 67

def has_index?(i)
  0 <= i and i < length
end

#regex_path_match(re, trees, args, &block) ⇒ Object

:nodoc:



140
141
142
143
144
# File 'lib/r_path.rb', line 140

def regex_path_match ( re, trees, args, &block ) # :nodoc:
  each do |x|
    x.regex_path_match(re, trees, args, &block)
  end
end

#symtbl_gsub(symtbl) ⇒ Object



89
90
91
92
93
94
95
96
97
# File 'lib/sym_tbl_gsub.rb', line 89

def symtbl_gsub ( symtbl )
  changed = false
  res = self.class.new
  each do |e|
    changed = true if new_e = e.symtbl_gsub(symtbl)
    res << (new_e || e)
  end
  changed ? res : nil
end

#to_cmdObject



43
44
45
# File 'lib/commands/helpers.rb', line 43

def to_cmd
  Commands::Command.new(*self)
end

#yaml_doc_traverse(activated) ⇒ Object



49
50
51
# File 'lib/yaml/transform.rb', line 49

def yaml_doc_traverse ( activated )
  self.each { |e| e.yaml_doc_traverse(activated) }
end