Sha256: d3656a4def57eba09c40b32c47aa1d38b7d1e0320c940b6fe3504c4cd94256b1

Contents?: true

Size: 1019 Bytes

Versions: 65

Compression:

Stored size: 1019 Bytes

Contents

class ConfigurableAttrHandler < YARD::Handlers::Ruby::Legacy::Base
  handles(/^\s*configurable_attr/)

  def process
    namespace[:configurable_attributes] ||= []
    
    attribute = token_to_object(statement.tokens[2])
    comments = statement.comments.join(' ') if statement.comments
    
    if statement.block
    # e.g. configurable_attr :datastore do FileDataStore.new end
      lazy_default_value = statement.block.to_s
    else
    # e.g. configurable_attr :fallback_mime_type, 'application/octet-stream'    
      default_value = token_to_object(statement.tokens[5..-1])
    end
    namespace[:configurable_attributes] << {
      :attribute => attribute,
      :default_value => default_value,
      :lazy_default_value => lazy_default_value,
      :comments => comments
    }
  end

  private

  def token_to_object(token)
    if token
      if token.is_a?(YARD::Parser::Ruby::Legacy::TokenList)
        eval(token.to_s)
      else # is a single token
        eval(token.text)
      end
    end
  end

end

Version data entries

65 entries across 65 versions & 4 rubygems

Version Path
classiccms-0.7.5 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.7.4 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.7.3 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.7.2 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.7.1 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.7.0 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
dragonfly-0.9.15 yard/handlers/configurable_attr_handler.rb
dragonfly-0.9.14 yard/handlers/configurable_attr_handler.rb
dragonfly-0.9.13 yard/handlers/configurable_attr_handler.rb
classiccms-0.6.9 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.8 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.7 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.6 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.5 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.4 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.3 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.2 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.1 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.6.0 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb
classiccms-0.5.17 vendor/bundle/gems/dragonfly-0.9.12/yard/handlers/configurable_attr_handler.rb