Class: HtmlSlicer::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/html_slicer/options.rb

Overview

Make options adjective and convinient for processing needs.

Direct Known Subclasses

ResizingOptions, SlicingOptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Options

Returns a new instance of Options.



11
12
13
14
15
# File 'lib/html_slicer/options.rb', line 11

def initialize(options)
  options ||= {}
  @only = options[:only]
  @except = options[:except]
end

Instance Attribute Details

#exceptObject (readonly)

Superclass



9
10
11
# File 'lib/html_slicer/options.rb', line 9

def except
  @except
end

#onlyObject (readonly)

Superclass



9
10
11
# File 'lib/html_slicer/options.rb', line 9

def only
  @only
end

Instance Method Details

#hexdigestObject



17
18
19
# File 'lib/html_slicer/options.rb', line 17

def hexdigest
  Digest::SHA1.hexdigest(string_value)
end

#string_valueObject



21
22
23
# File 'lib/html_slicer/options.rb', line 21

def string_value
  instance_variables.map {|name| name.to_s + ":" + instance_variable_get(name).to_s}.join
end