Sha256: 4f51a7d431b447576ee4452ca892d86f9ff5f843294d739d782dbd8f0abd8ea4
Contents?: true
Size: 953 Bytes
Versions: 1
Compression:
Stored size: 953 Bytes
Contents
# encoding: utf-8 module Policy class CLI < Hexx::CLI::Base # Decorates the string with #name and #type methods for described attribute # # @api private class Attribute # @!scope class # @!method new(source) # Creates the decorator # # @param [String] source # # @return [Policy::CLI::Attribute] # @private def initialize(source) @source = source end # The name of the attribute # # @return [String] def name @type ||= begin value = @source[/^\w+/] value ? value.snake_case : "@todo" end end # The type of the attribute # # @return [String] def type @type ||= begin value = @source[/(?<=\{)(.+)(?=\})/] value ? Hexx::CLI::Name.new(value).type : "@todo" end end end # class Attribute end # class CLI end # module Policy
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
policy-2.0.0 | lib/policy/cli/attribute.rb |