Class: Html2rss::AttributePostProcessors::Substring

Inherits:
Object
  • Object
show all
Defined in:
lib/html2rss/attribute_post_processors/substring.rb

Instance Method Summary collapse

Constructor Details

#initialize(value, options, _item) ⇒ Substring

Returns a new instance of Substring.



4
5
6
7
# File 'lib/html2rss/attribute_post_processors/substring.rb', line 4

def initialize(value, options, _item)
  @value = value
  @options = options
end

Instance Method Details

#getObject



9
10
11
12
# File 'lib/html2rss/attribute_post_processors/substring.rb', line 9

def get
  ending = @options.fetch('end', false) ? @options['end'].to_i : @value.length
  @value[@options['start'].to_i..ending]
end