Class: Wood::Types::BuiltinType
- Inherits:
-
Struct
- Object
- Struct
- Wood::Types::BuiltinType
show all
- Includes:
- TypeMatching
- Defined in:
- lib/wood/types.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
included
Constructor Details
#initialize(name, numeric = false, *aliases) ⇒ BuiltinType
Returns a new instance of BuiltinType.
172
173
174
175
176
177
178
179
180
181
182
183
|
# File 'lib/wood/types.rb', line 172
def initialize(name, numeric = false, *aliases)
super(name)
@aliases = aliases
@numeric = numeric
if numeric?
Types::NUMERIC_TYPES << self
else
Types::NON_NUMERIC_TYPES << self
end
end
|
Instance Attribute Details
#aliases ⇒ Object
Returns the value of attribute aliases.
170
171
172
|
# File 'lib/wood/types.rb', line 170
def aliases
@aliases
end
|
#name ⇒ Object
Returns the value of attribute name
168
169
170
|
# File 'lib/wood/types.rb', line 168
def name
@name
end
|
#zero_value ⇒ Object
Returns the value of attribute zero_value.
171
172
173
|
# File 'lib/wood/types.rb', line 171
def zero_value
@zero_value
end
|
Instance Method Details
#==(other) ⇒ Object
201
202
203
204
205
206
207
208
|
# File 'lib/wood/types.rb', line 201
def == other
case other
when BuiltinType
return name == other.name
else
return false
end
end
|
#builtin? ⇒ Boolean
189
190
191
|
# File 'lib/wood/types.rb', line 189
def builtin?
true
end
|
#node_name ⇒ Object
197
198
199
|
# File 'lib/wood/types.rb', line 197
def node_name
(Array(name).map(&:to_s).join("_") + "_type").snake_cased.to_sym
end
|
#numeric? ⇒ Boolean
185
186
187
|
# File 'lib/wood/types.rb', line 185
def numeric?
@numeric
end
|
#sexp ⇒ Object
193
194
195
|
# File 'lib/wood/types.rb', line 193
def sexp
name
end
|
#type ⇒ Object
210
211
212
|
# File 'lib/wood/types.rb', line 210
def type
self
end
|