Sha256: 4a3cc22218b5dff79de407bc3011079c2ea89a9f8317998ec4b219e2dad275e0
Contents?: true
Size: 980 Bytes
Versions: 2
Compression:
Stored size: 980 Bytes
Contents
module CopyleaksApi class Config DEFAULTS = { sandbox_mode: false, allow_partial_scan: false, http_callback: nil, email_callback: nil, custom_fields: {}, compare_only: false, in_progress_result: nil, }.freeze class << self attr_writer :sandbox_mode, :compare_only, :http_callback, :email_callback, :custom_fields, :allow_partial_scan, :in_progress_result DEFAULTS.each do |attr, value| # getters for all options define_method(attr) do var = instance_variable_get("@#{attr}") return var if var instance_variable_set("@#{attr}", value) end end # provide block syntax possibility for setting options def config yield(self) end # reset all options to default def reset DEFAULTS.each { |attr, value| instance_variable_set("@#{attr}", value) } end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
plagiarism-checker-2.1.0 | lib/copyleaks_api/config.rb |
plagiarism-checker-2.0.0 | lib/copyleaks_api/config.rb |