lib/clamp/parameter/definition.rb in clamp-1.2.1 vs lib/clamp/parameter/definition.rb in clamp-1.3.0
- old
+ new
@@ -1,10 +1,14 @@
+# frozen_string_literal: true
+
require "clamp/attribute/definition"
module Clamp
module Parameter
+ # Represents an parameter of a Clamp::Command class.
+ #
class Definition < Attribute::Definition
def initialize(name, description, options = {})
@name = name
@description = description
@@ -38,14 +42,16 @@
VALID_ATTRIBUTE_NAME = /^[a-z0-9_]+$/
def infer_attribute_name
inferred_name = name.downcase.tr("-", "_").sub(ELLIPSIS_SUFFIX, "").sub(OPTIONAL) { Regexp.last_match(1) }
- unless inferred_name =~ VALID_ATTRIBUTE_NAME
- raise "cannot infer attribute_name from #{name.inspect}"
- end
+ raise "cannot infer attribute_name from #{name.inspect}" unless inferred_name =~ VALID_ATTRIBUTE_NAME
inferred_name += "_list" if multivalued?
inferred_name
+ end
+
+ def required_indicator
+ # implied by LHS
end
end
end