module DocWrapper::Base
Public Class Methods
to_target_doc(src , opts={})
click to toggle source
# File lib/doc_wrapper/base.rb, line 5 def self.to_target_doc src , opts={} wrapper = wrapper_target src, opts wrapper.to_target_doc src end
wrapper_target(src, opts={})
click to toggle source
# File lib/doc_wrapper/base.rb, line 10 def self.wrapper_target src, opts={} doc_origem = infer_doc_origem src, opts klass_str = klass_name doc_origem, opts klass_str.constantize end
Private Class Methods
infer_doc_origem(src, opts)
click to toggle source
# File lib/doc_wrapper/base.rb, line 42 def self.infer_doc_origem src, opts origem = opts[:origin] || opts[:origem] || opts[:owner] || opts[:doc] unless origem if src.is_a? Hash origem = src[:origin] || src[:origem] || src[:owner] || src[:doc] else origem = src end end origem = origem.to_s.underscore.strip.gsub(/-/, "_") origem end
klass_name(origem, opts={})
click to toggle source
# File lib/doc_wrapper/base.rb, line 19 def self.klass_name origem, opts={} def_opts = Rails.configuration.doc_wrapper if Rails.configuration.respond_to? 'doc_wrapper' opts = def_opts.merge(opts) if def_opts modulle = "#{opts[:module].to_s.underscore}" if opts[:module] prefix = "#{opts[:prefix]}_" if opts[:prefix] sufix = "_#{opts[:sufix]}" if opts[:sufix] prefix = "doc_By_" unless prefix modulle = "doc_wrapper" unless modulle modulle_arr = origem.split('/') origem = modulle_arr.pop modulle_arr.insert(0, modulle) modulle = modulle_arr.join('/') + '/' "#{modulle}#{prefix}#{origem}#{sufix}".camelize end