Class: Oval::ArrayItem

Inherits:
Base
  • Object
show all
Defined in:
lib/oval/array_item.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

ensure_equal, it_should, validate

Constructor Details

#initialize(item_decl) ⇒ ArrayItem

Returns a new instance of ArrayItem.



18
19
20
# File 'lib/oval/array_item.rb', line 18

def initialize(item_decl)
  self.item_decl = item_decl
end

Instance Attribute Details

#item_declObject

Returns the value of attribute item_decl.



22
23
24
# File 'lib/oval/array_item.rb', line 22

def item_decl
  @item_decl
end

Class Method Details

.[](item_decl) ⇒ Object



14
15
16
# File 'lib/oval/array_item.rb', line 14

def self.[](item_decl)
  new(item_decl)
end

Instance Method Details

#it_shouldObject



10
11
12
# File 'lib/oval/array_item.rb', line 10

def it_should
  self.class.it_should(item_decl)
end

#validate(item, i, subject = nil) ⇒ Object



5
6
7
8
# File 'lib/oval/array_item.rb', line 5

def validate(item, i, subject = nil)
  item_subject = subject.nil? ? nil : "#{subject}[#{i}]"
  self.class.validate(item,item_decl,item_subject)
end