Class: WickedPdf::OptionParser
- Inherits:
-
Object
- Object
- WickedPdf::OptionParser
- Defined in:
- lib/wicked_pdf/option_parser.rb
Constant Summary collapse
- BINARY_VERSION_WITHOUT_DASHES =
Gem::Version.new('0.12.0')
Instance Attribute Summary collapse
-
#binary_version ⇒ Object
readonly
Returns the value of attribute binary_version.
-
#hf_tempfiles ⇒ Object
readonly
Returns the value of attribute hf_tempfiles.
Instance Method Summary collapse
-
#initialize(binary_version = WickedPdf::DEFAULT_BINARY_VERSION) ⇒ OptionParser
constructor
A new instance of OptionParser.
- #parse(options) ⇒ Object
- #valid_option(name) ⇒ Object
Constructor Details
#initialize(binary_version = WickedPdf::DEFAULT_BINARY_VERSION) ⇒ OptionParser
Returns a new instance of OptionParser.
7 8 9 |
# File 'lib/wicked_pdf/option_parser.rb', line 7 def initialize(binary_version = WickedPdf::DEFAULT_BINARY_VERSION) @binary_version = binary_version end |
Instance Attribute Details
#binary_version ⇒ Object (readonly)
Returns the value of attribute binary_version.
5 6 7 |
# File 'lib/wicked_pdf/option_parser.rb', line 5 def binary_version @binary_version end |
#hf_tempfiles ⇒ Object (readonly)
Returns the value of attribute hf_tempfiles.
5 6 7 |
# File 'lib/wicked_pdf/option_parser.rb', line 5 def hf_tempfiles @hf_tempfiles end |
Instance Method Details
#parse(options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/wicked_pdf/option_parser.rb', line 11 def parse() [ parse_extra(), parse_others(), parse_global(), parse_outline(.delete(:outline)), (:header => .delete(:header), :footer => .delete(:footer), :layout => [:layout]), parse_cover(.delete(:cover)), parse_toc(.delete(:toc)), parse_basic_auth() ].flatten end |
#valid_option(name) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/wicked_pdf/option_parser.rb', line 26 def valid_option(name) if binary_version < BINARY_VERSION_WITHOUT_DASHES "--#{name}" else name end end |