class WWWJDic::Parser
This class is a simple utility that is used to parse and filter parameters for wwwjdic.
- Author
- Copyright
-
© 2014-2021 Marco Bresciani
- License
-
GNU General Public License version 3
Attributes
parsers[R]
Public Class Methods
new(args = {})
click to toggle source
# File lib/wwwjdic/parser.rb, line 39 def initialize(args = {}) @parsers = {} ALL_PARAMS.each { |param| parsers[param] = args[param] } unless args.nil? end
Public Instance Methods
parse(method = nil, params = nil)
click to toggle source
Provides the duck type for a generic parsing object.
# File lib/wwwjdic/parser.rb, line 45 def parse(method = nil, params = nil) a_parser = nil a_parser = parsers[method.to_sym] unless method.nil? || parsers.nil? a_parser&.parse params end