class MarkdownRubyDocumentation::ConstantsPresenter
Attributes
subject[R]
Public Class Methods
format(value)
click to toggle source
# File lib/markdown_ruby_documentation/constants_presenter.rb, line 18 def self.format(value) case value when Numeric ActiveSupport::NumberHelper.number_to_delimited(value) when String value.inspect else if value.to_s =~ /#<[a-zA-Z0-9\-_:]+:[0-9xa-f]+>/ nil else value end end end
new(subject)
click to toggle source
# File lib/markdown_ruby_documentation/constants_presenter.rb, line 6 def initialize(subject) @subject = subject end
Public Instance Methods
call(interface)
click to toggle source
# File lib/markdown_ruby_documentation/constants_presenter.rb, line 10 def call(interface) constants.each do |const_name, value| next if value.nil? interface[const_name] = { text: value, method_object: Method.create("#{subject.name}::#{const_name}", null_method: true) } end interface end
Private Instance Methods
constants()
click to toggle source
# File lib/markdown_ruby_documentation/constants_presenter.rb, line 35 def constants subject.constants.each_with_object({}) do |v, const| c = subject.const_get(v) const[v] = self.class.format(c) unless [Regexp, Module, Class].include?(c.class) end end