Class: HtmlSlicer::Mappers::Slicing
- Inherits:
-
Object
- Object
- HtmlSlicer::Mappers::Slicing
- Defined in:
- lib/html_slicer/mappers/slicing.rb
Overview
Slicing engine, generate and store resizing Map (hash)
Defined Under Namespace
Classes: Map
Instance Attribute Summary collapse
-
#map ⇒ Object
readonly
Returns the value of attribute map.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#slice_number ⇒ Object
readonly
Returns the value of attribute slice_number.
Instance Method Summary collapse
-
#initialize(document, options) ⇒ Slicing
constructor
A new instance of Slicing.
Methods included from Utilities::NodeMatchExtension
Methods included from Utilities::ParseNode
Constructor Details
#initialize(document, options) ⇒ Slicing
Returns a new instance of Slicing.
20 21 22 23 24 25 26 27 |
# File 'lib/html_slicer/mappers/slicing.rb', line 20 def initialize(document, ) raise(TypeError, "::HTML::Document expected, '#{document.class}' passed") unless document.is_a?(::HTML::Document) raise(TypeError, "HtmlSlicer::Options expected, '#{.class}' passed") unless .is_a?(HtmlSlicer::Options) @options = @map = Map.new @slice_number = 1 @options.unit.is_a?(Hash) ? process_by_node!(document.root) : process_by_text!(document.root) end |
Instance Attribute Details
#map ⇒ Object (readonly)
Returns the value of attribute map.
5 6 7 |
# File 'lib/html_slicer/mappers/slicing.rb', line 5 def map @map end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
5 6 7 |
# File 'lib/html_slicer/mappers/slicing.rb', line 5 def @options end |
#slice_number ⇒ Object (readonly)
Returns the value of attribute slice_number.
5 6 7 |
# File 'lib/html_slicer/mappers/slicing.rb', line 5 def slice_number @slice_number end |