Class: Netprint::Options
- Inherits:
-
Object
- Object
- Netprint::Options
- Defined in:
- lib/netprint/options.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #apply(form) ⇒ Object
-
#initialize(options = {}) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(options = {}) ⇒ Options
Returns a new instance of Options.
5 6 7 8 9 10 11 12 13 |
# File 'lib/netprint/options.rb', line 5 def initialize( = {}) = { :paper_size => PAPERSIZE::A4, :color => COLOR::BW, :code_type => CODE_TYPE::ALNUM, :secret_code => nil, :email => nil }.merge() end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
3 4 5 |
# File 'lib/netprint/options.rb', line 3 def end |
Instance Method Details
#apply(form) ⇒ Object
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/netprint/options.rb', line 15 def apply(form) (form, 'yus-size', [:paper_size]) (form, 'iro-cl', [:color]) (form, 'yyk-type-cl', [:code_type]) (form, 'pin-num-set-fl', [:secret_code] =~ /^\d{4}$/ ? '1' : '0') (form, 'notice-onoff', [:email] ? '1' : '0') form['pin-no'] = [:secret_code] if [:secret_code] =~ /^\d{4}$/ form['mail-adr-to-tx'] = [:email] if [:email] end |