Method: Ruber::PluginSpecificationReader::Option#default

Defined in:
lib/ruber/plugin_specification_reader.rb

#default(bind = TOPLEVEL_BINDING) ⇒ Object

Returns the default value of the option, computed basing on the value stored in the default entry in the option description in the PDF. In particular:

  • if the value is not a string, it is returned unchanged

  • if the value is a string and the eval_default attribute has been set to false in the PDF, it is returned unchanged

  • if it is a string, it is evaluated in the bindings bind (using eval) and

the corresponding value is returned. If eval raises SyntaxError, NoMethodError or NameError then the string is returned unchanged (of course, the exception isn’t propagated).



44
45
46
47
48
49
50
51
52
53
# File 'lib/ruber/plugin_specification_reader.rb', line 44

def default bind = TOPLEVEL_BINDING
  val = super()
  if val.is_a? String and self.eval_default
    begin eval val, bind
    rescue NoMethodError, SyntaxError, NameError, ArgumentError
      val
    end
  else val
  end
end