class Ahnnotate::Options
Public Class Methods
attr_question(*names)
click to toggle source
# File lib/ahnnotate/options.rb, line 12 def self.attr_question(*names) names.each do |name| attr_writer(name) define_method("#{name}?") do !!instance_variable_get("@#{name}") end end end
attr_writer(*names)
click to toggle source
Calls superclass method
# File lib/ahnnotate/options.rb, line 7 def self.attr_writer(*names) attribute_names.push(*names) super end
attribute_names()
click to toggle source
# File lib/ahnnotate/options.rb, line 3 def self.attribute_names @attribute_names ||= [] end
new(**args)
click to toggle source
# File lib/ahnnotate/options.rb, line 26 def initialize(**args) args.each do |key, value| public_send("#{key}=", value) end end
Public Instance Methods
to_s()
click to toggle source
# File lib/ahnnotate/options.rb, line 32 def to_s output = StringIO.new output.puts "🧐 options:" self.class.attribute_names.each do |attribute_name| output.print "🧐 #{attribute_name}: " if instance_variable_defined?("@#{attribute_name}") output.puts "undefined" else output.puts instance_variable_get("@#{attribute_name}").inspect end end output.string end