class MarkdownRubyDocumentation::AnyArgs
Attributes
args[R]
caller[R]
disable_processors[R]
for_method[R]
method_creator[R]
print_method_source[R]
source_code[R]
Public Class Methods
new(args:, print_method_source:, caller:, for_method:, method_creator:)
click to toggle source
# File lib/markdown_ruby_documentation/template_parser/any_args.rb, line 5 def initialize(args:, print_method_source:, caller:, for_method:, method_creator:) @args = args @print_method_source = print_method_source @caller = caller @for_method = for_method @method_creator = method_creator call end
Private Instance Methods
call()
click to toggle source
# File lib/markdown_ruby_documentation/template_parser/any_args.rb, line 18 def call if args.first.is_a?(Hash) when_hash_first(args.first) elsif args.first.is_a?(String) when_string_first(args) elsif args.empty? when_no_args else raise ArgumentError, "Incorrect arguments given: #{for_method}(#{args})", caller end end
when_hash_first(options)
click to toggle source
# File lib/markdown_ruby_documentation/template_parser/any_args.rb, line 30 def when_hash_first(options) @disable_processors = options if options.has_key?(:method_reference) @source_code = print_method_source.call(method_creator.call(options[:method_reference])) else @source_code = print_method_source.call end end
when_no_args()
click to toggle source
# File lib/markdown_ruby_documentation/template_parser/any_args.rb, line 44 def when_no_args @disable_processors = {} @source_code = print_method_source.call end
when_string_first(args)
click to toggle source
# File lib/markdown_ruby_documentation/template_parser/any_args.rb, line 39 def when_string_first(args) @source_code = args.first @disable_processors = args[1] || {} end