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_type, #new_value

Constructor Details

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

Returns a new instance of Array.



237
238
239
240
241
242
243
244
245
# File 'lib/ron/graphedge.rb', line 237

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



247
248
249
# File 'lib/ron/graphedge.rb', line 247

def old_value
  context[@index]
end

#replace(*newvals) ⇒ Object



255
256
257
258
# File 'lib/ron/graphedge.rb', line 255

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