Sha256: 96776595c9760c196264d2550906c21cb3f54ab28779293bbaa4bd1ff1b6acd1
Contents?: true
Size: 796 Bytes
Versions: 3
Compression:
Stored size: 796 Bytes
Contents
module Clamp class Attribute attr_reader :description, :attribute_name, :default_value, :environment_variable def help_rhs description + default_description end def help [help_lhs, help_rhs] end def ivar_name "@#{attribute_name}" end def read_method attribute_name end def default_method "default_#{read_method}" end def write_method "#{attribute_name}=" end private def default_description default_sources = [ ("$#{@environment_variable}" if defined?(@environment_variable)), (@default_value.inspect if defined?(@default_value)) ].compact return "" if default_sources.empty? " (default: " + default_sources.join(", or ") + ")" end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clamp-0.5.1 | lib/clamp/attribute.rb |
clamp-0.5.0 | lib/clamp/attribute.rb |
clamp-0.4.0 | lib/clamp/attribute.rb |