Class: I18nChecker::Cache::Line

Inherits:
Object
  • Object
show all
Defined in:
lib/i18n_checker/cache.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(line_number, content) ⇒ Line

Returns a new instance of Line.



101
102
103
104
# File 'lib/i18n_checker/cache.rb', line 101

def initialize(line_number, content)
  @line = line_number
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



99
100
101
# File 'lib/i18n_checker/cache.rb', line 99

def content
  @content
end

#lineObject (readonly)

Returns the value of attribute line.



99
100
101
# File 'lib/i18n_checker/cache.rb', line 99

def line
  @line
end

Instance Method Details

#[](range) ⇒ Object



106
107
108
# File 'lib/i18n_checker/cache.rb', line 106

def [](range)
  columns_of(range)
end

#columns_of(range) ⇒ Object



110
111
112
# File 'lib/i18n_checker/cache.rb', line 110

def columns_of(range)
  content[range.first - 1, range.last]
end

#start_of(text, at = 0) ⇒ Object



114
115
116
# File 'lib/i18n_checker/cache.rb', line 114

def start_of(text, at = 0)
  content.index(text, at)
end

#to_sObject



118
119
120
# File 'lib/i18n_checker/cache.rb', line 118

def to_s
  content
end