Sha256: e59e27150ef73bc9a7e3594e1c1280611e6b35c010105a6435d3a00e0d0c7555

Contents?: true

Size: 631 Bytes

Versions: 3

Compression:

Stored size: 631 Bytes

Contents

module YARD
  module Rails
    module Legacy
      class ClassAttributeHandler < YARD::Handlers::Ruby::Legacy::AttributeHandler
        handles /\A[cm]attr_(reader|writer|accessor)(?:\s|\()/
        namespace_only
        
        def process
          # HACK: Strip the [c,m] off of the front of the method, so that
          # AttributeHandler will be able to correctly detect the resulting
          # method as read/write.
          new_text = statement.tokens.first.text.to_s[1..-1]
          statement.tokens.first.set_text(new_text)

          push_state(:scope => :class) { super }
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
yard-rails-0.3.0 lib/yard-rails/legacy/class_attribute_handler.rb
yard-rails-0.2.0 lib/yard-rails/legacy/class_attribute_handler.rb
yard-rails-0.1.0 lib/yard-rails/legacy/class_attribute_handler.rb