Module: Dox::DSL::Syntax

Extended by:
ActiveSupport::Concern
Defined in:
lib/dox/dsl/syntax.rb

Instance Method Summary collapse

Instance Method Details

#_subjectsObject



27
28
29
# File 'lib/dox/dsl/syntax.rb', line 27

def _subjects
  @_subjects ||= {}
end

#const_missing(name) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dox/dsl/syntax.rb', line 11

def const_missing(name)
  documentation = _subjects[infer_subject(name)]

  return super unless documentation

  Module.new do
    define_singleton_method :included do |base|
      base..merge! documentation.config
    end
  end
end

#document(subject, &block) ⇒ Object



6
7
8
9
# File 'lib/dox/dsl/syntax.rb', line 6

def document(subject, &block)
  documentation = _subjects[subject] = Documentation.new(subject: subject)
  documentation.instance_eval(&block)
end

#infer_subject(name) ⇒ Object



23
24
25
# File 'lib/dox/dsl/syntax.rb', line 23

def infer_subject(name)
  name.to_s.underscore.to_sym
end