Class: HtmlSlicer::SlicingOptions
- Defined in:
- lib/html_slicer/options.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#complete ⇒ Object
readonly
Returns the value of attribute complete.
-
#limit ⇒ Object
readonly
Returns the value of attribute limit.
-
#maximum ⇒ Object
readonly
Returns the value of attribute maximum.
-
#text_break ⇒ Object
readonly
Returns the value of attribute text_break.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
Attributes inherited from Options
Instance Method Summary collapse
-
#initialize(options) ⇒ SlicingOptions
constructor
A new instance of SlicingOptions.
Methods inherited from Options
Constructor Details
#initialize(options) ⇒ SlicingOptions
Returns a new instance of SlicingOptions.
30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/html_slicer/options.rb', line 30 def initialize() super() @unit = case [:unit] when Hash, Regexp then [:unit] when String then /#{[:unit]}/ when nil then /&#?\w+;|\S/ else raise "Invalid :unit definition '#{[:unit].inspect}'" end @maximum = case [:maximum] when Fixnum then if [:maximum] > 0 [:maximum] else raise "Invalid :maximum definition. Has to be more than zero, '#{[:unit].inspect}' passed" end when nil then case unit when String, Regexp then 300 when Hash then 10 else 2000 end else raise "Invalid :maximum definition '#{[:maximum].inspect}'" end @complete = case [:complete] when Regexp then [:complete] when nil then nil else raise "Invalid :complete option definition '#{[:complete].inspect}'" end @limit = case [:limit] when Fixnum, nil then [:limit] else raise "Invalid :limit option definition '#{[:limit].inspect}'" end @text_break = [:text_break] end |
Instance Attribute Details
#complete ⇒ Object (readonly)
Returns the value of attribute complete.
28 29 30 |
# File 'lib/html_slicer/options.rb', line 28 def complete @complete end |
#limit ⇒ Object (readonly)
Returns the value of attribute limit.
28 29 30 |
# File 'lib/html_slicer/options.rb', line 28 def limit @limit end |
#maximum ⇒ Object (readonly)
Returns the value of attribute maximum.
28 29 30 |
# File 'lib/html_slicer/options.rb', line 28 def maximum @maximum end |
#text_break ⇒ Object (readonly)
Returns the value of attribute text_break.
28 29 30 |
# File 'lib/html_slicer/options.rb', line 28 def text_break @text_break end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
28 29 30 |
# File 'lib/html_slicer/options.rb', line 28 def unit @unit end |