Class: Wood::Types::CustomType
- Inherits:
-
Struct
- Object
- Struct
- Wood::Types::CustomType
show all
- Includes:
- TypeMatching
- Defined in:
- lib/wood/types.rb
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
included
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
163
164
165
|
# File 'lib/wood/types.rb', line 163
def method_missing(method, *args)
type.__send__(method, *args)
end
|
Instance Attribute Details
#type ⇒ Object
Returns the value of attribute type
110
111
112
|
# File 'lib/wood/types.rb', line 110
def type
@type
end
|
Class Method Details
.[](type) ⇒ Object
112
113
114
115
116
117
118
119
120
121
122
123
|
# File 'lib/wood/types.rb', line 112
def self.[](type)
case type
when BuiltinType
return type
when CustomType
return type
when CompoundType
return type
else
new(type)
end
end
|
Instance Method Details
#==(other) ⇒ Object
133
134
135
136
137
138
139
140
|
# File 'lib/wood/types.rb', line 133
def == other
case other
when CustomType
return type == other.type
else
return type == other
end
end
|
#===(other) ⇒ Object
142
143
144
145
146
147
148
149
|
# File 'lib/wood/types.rb', line 142
def === other
case other
when CustomType
return type === other.type
else
return type === other
end
end
|
#builtin? ⇒ Boolean
155
156
157
|
# File 'lib/wood/types.rb', line 155
def builtin?
false
end
|
#name ⇒ Object
159
160
161
|
# File 'lib/wood/types.rb', line 159
def name
type.name
end
|
#node_name ⇒ Object
125
126
127
|
# File 'lib/wood/types.rb', line 125
def node_name
:custom_type
end
|
#numeric? ⇒ Boolean
151
152
153
|
# File 'lib/wood/types.rb', line 151
def numeric?
false
end
|
#sexp ⇒ Object
129
130
131
|
# File 'lib/wood/types.rb', line 129
def sexp
[:custom_type, type.sexp]
end
|