Method: Wrapture::ConstantSpec#initialize
- Defined in:
- lib/wrapture/constant_spec.rb
#initialize(spec) ⇒ ConstantSpec
Creates a constant spec based on the provided hash spec
The hash must have the following keys:
- name
-
the name of the constant
- type
-
the type of the constant
- value
-
the value to assign to the constant
- includes
-
a list of includes that need to be added in order for this
constant to be valid (for example, includes for the type and value).
The following keys are optional:
- doc
-
a string containing the documentation for this constant
50 51 52 53 54 |
# File 'lib/wrapture/constant_spec.rb', line 50 def initialize(spec) @spec = ConstantSpec.normalize_spec_hash(spec) @doc = @spec.key?('doc') ? Comment.new(@spec['doc']) : nil @type = TypeSpec.new(@spec['type']) end |