Class: Wcl::Decorator

Inherits:
Object
  • Object
show all
Defined in:
lib/wcl/types.rb

Overview

A WCL decorator with name and arguments.

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#argsObject (readonly)

Returns the value of attribute args.



48
49
50
# File 'lib/wcl/types.rb', line 48

def args
  @args
end

#nameObject (readonly)

Returns the value of attribute name.



48
49
50
# File 'lib/wcl/types.rb', line 48

def name
  @name
end

Instance Method Details

#inspectObject Also known as: to_s



59
60
61
# File 'lib/wcl/types.rb', line 59

def inspect
  "#<Wcl::Decorator(@#{@name})>"
end

#to_hObject



55
56
57
# File 'lib/wcl/types.rb', line 55

def to_h
  { name: @name, args: @args }
end