Class: Ron::GraphEdge::Array

Inherits:
Ron::GraphEdge show all
Defined in:
lib/ron/graphedge.rb

Overview


Instance Attribute Summary

Attributes inherited from Ron::GraphEdge

#context, #index, #len

Instance Method Summary collapse

Methods inherited from Ron::GraphEdge

#call, #context_died, #context_type, #new_value

Constructor Details

#initialize(context, index, len = 1) ⇒ Array

Returns a new instance of Array.



180
181
182
183
184
185
186
187
188
# File 'lib/ron/graphedge.rb', line 180

def initialize(context,index,len=1)
  super
  
  if Range===@index 
    @len=@index.last-@index.first
    @len-=1 if @len.exclude_end?
    @index=@index.first
  end
end

Instance Method Details

#old_valueObject



190
191
192
# File 'lib/ron/graphedge.rb', line 190

def old_value
  context[@index]
end

#replace(*newvals) ⇒ Object



194
195
196
197
# File 'lib/ron/graphedge.rb', line 194

def replace(*newvals)
  newvals.empty? and newvals=[new_value]
  context[@index]=*newvals
end