Class: AttributedString::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/attributed_string/attribute.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(range, data) ⇒ Attribute

Returns a new instance of Attribute.



6
7
8
9
# File 'lib/attributed_string/attribute.rb', line 6

def initialize(range, data)
  @range = range
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



4
5
6
# File 'lib/attributed_string/attribute.rb', line 4

def data
  @data
end

#rangeObject (readonly)

Returns the value of attribute range.



4
5
6
# File 'lib/attributed_string/attribute.rb', line 4

def range
  @range
end

Instance Method Details

#move(offset) ⇒ Object



11
12
13
# File 'lib/attributed_string/attribute.rb', line 11

def move(offset)
  @range = Range.new(@range.begin + offset, @range.end + offset, @range.exclude_end?)
end