Parent

Clamp::Attribute::Definition

Attributes

description[R]
environment_variable[R]

Public Class Methods

new(options) click to toggle source
# File lib/clamp/attribute/definition.rb, line 8
def initialize(options)
  if options.has_key?(:attribute_name)
    @attribute_name = options[:attribute_name].to_s
  end
  if options.has_key?(:default)
    @default_value = options[:default]
  end
  if options.has_key?(:environment_variable)
    @environment_variable = options[:environment_variable]
  end
  if options.has_key?(:hidden)
    @hidden = options[:hidden]
  end
end

Public Instance Methods

append_method() click to toggle source
# File lib/clamp/attribute/definition.rb, line 49
def append_method
  if multivalued?
    "append_to_#{attribute_name}"
  end
end
attribute_name() click to toggle source
# File lib/clamp/attribute/definition.rb, line 67
def attribute_name
  @attribute_name ||= infer_attribute_name
end
default_method() click to toggle source
# File lib/clamp/attribute/definition.rb, line 41
def default_method
  "default_#{read_method}"
end
default_value() click to toggle source
# File lib/clamp/attribute/definition.rb, line 71
def default_value
  if defined?(@default_value)
    @default_value
  elsif multivalued?
    []
  end
end
help() click to toggle source
# File lib/clamp/attribute/definition.rb, line 29
def help
  [help_lhs, help_rhs]
end
help_rhs() click to toggle source
# File lib/clamp/attribute/definition.rb, line 25
def help_rhs
  description + default_description
end
hidden?() click to toggle source
# File lib/clamp/attribute/definition.rb, line 63
def hidden?
  @hidden
end
ivar_name() click to toggle source
# File lib/clamp/attribute/definition.rb, line 33
def ivar_name
  "@#{attribute_name}"
end
multivalued?() click to toggle source
# File lib/clamp/attribute/definition.rb, line 55
def multivalued?
  @multivalued
end
of(command) click to toggle source
# File lib/clamp/attribute/definition.rb, line 79
def of(command)
  Attribute::Instance.new(self, command)
end
read_method() click to toggle source
# File lib/clamp/attribute/definition.rb, line 37
def read_method
  attribute_name
end
required?() click to toggle source
# File lib/clamp/attribute/definition.rb, line 59
def required?
  @required
end
write_method() click to toggle source
# File lib/clamp/attribute/definition.rb, line 45
def write_method
  "#{attribute_name}="
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.