Class: Wcl::Decorator
- Inherits:
-
Object
- Object
- Wcl::Decorator
- Defined in:
- lib/wcl/types.rb
Overview
A WCL decorator with name and arguments.
Instance Attribute Summary collapse
-
#args ⇒ Object
readonly
Returns the value of attribute args.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(name:, args: {}) ⇒ Decorator
constructor
A new instance of Decorator.
- #inspect ⇒ Object (also: #to_s)
- #to_h ⇒ Object
Constructor Details
#initialize(name:, args: {}) ⇒ Decorator
Returns a new instance of Decorator.
50 51 52 53 |
# File 'lib/wcl/types.rb', line 50 def initialize(name:, args: {}) @name = name @args = args end |
Instance Attribute Details
#args ⇒ Object (readonly)
Returns the value of attribute args.
48 49 50 |
# File 'lib/wcl/types.rb', line 48 def args @args end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
48 49 50 |
# File 'lib/wcl/types.rb', line 48 def name @name end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
59 60 61 |
# File 'lib/wcl/types.rb', line 59 def inspect "#<Wcl::Decorator(@#{@name})>" end |
#to_h ⇒ Object
55 56 57 |
# File 'lib/wcl/types.rb', line 55 def to_h { name: @name, args: @args } end |