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