Class: Array

Inherits:
Object show all
Defined in:
lib/web/assertinclude.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#__index(key) ⇒ Object



6
7
8
# File 'lib/web/assertinclude.rb', line 6

def __index(key)
  self[key]
end

#compare_includes?(haystack, prefix = []) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/web/assertinclude.rb', line 10

def compare_includes? haystack, prefix=[]
	message = ""
  each_with_index{ |v, k|
    fullname = prefix.clone
    if fullname.length > 0
      fullname[fullname.length-1] = "#{fullname.last}[#{k}]"
    else
      fullname[0] = "<Array>[#{k}]"
    end
    fullname_str = fullname.join(".")
    message += do_thing(haystack, k, v, fullname, fullname_str)
  }
  message
end

#has_key?(index) ⇒ Boolean

Returns:

  • (Boolean)


2
3
4
# File 'lib/web/assertinclude.rb', line 2

def has_key?(index)
  index >= 0 && index < length
end