Class: Annotable::Annotation
- Inherits:
-
Object
- Object
- Annotable::Annotation
- Defined in:
- lib/annotable/annotation.rb
Overview
Encapsulates annotation data: name, params & options.
my_annotation = Annotation.new(:name, ["some", "params"], {some: "options"})
my_annotation.name # => :name
my_annotation.params # => ["some", "params"]
my_annotation. # => {some: "options"}
Instance Attribute Summary collapse
-
#name ⇒ Symbol
readonly
The annotation’s name.
-
#options ⇒ Hash<Symbol, Object>
readonly
The annotation’s options.
-
#params ⇒ Array<Object>
readonly
The annotation’s params.
Instance Method Summary collapse
-
#initialize(name, params = [], options = {}) ⇒ Annotation
constructor
Creates an new annotation.
Constructor Details
#initialize(name, params = [], options = {}) ⇒ Annotation
Creates an new annotation.
27 28 29 30 31 |
# File 'lib/annotable/annotation.rb', line 27 def initialize(name, params = [], = {}) @name = name @params = params @options = end |
Instance Attribute Details
#name ⇒ Symbol (readonly)
Returns The annotation’s name.
14 15 16 |
# File 'lib/annotable/annotation.rb', line 14 def name @name end |
#options ⇒ Hash<Symbol, Object> (readonly)
Returns The annotation’s options.
18 19 20 |
# File 'lib/annotable/annotation.rb', line 18 def @options end |
#params ⇒ Array<Object> (readonly)
Returns The annotation’s params.
16 17 18 |
# File 'lib/annotable/annotation.rb', line 16 def params @params end |