Class: AutoC::STD::Primitive
- Includes:
- Entity
- Defined in:
- lib/autoc/std.rb
Overview
Base class for a more elaborate primitive type directly includable into the module as a dependency
Direct Known Subclasses
Constant Summary collapse
- @@types =
::Set.new
Constants included from Entity
Instance Attribute Summary collapse
-
#matcher ⇒ Object
readonly
Returns the value of attribute matcher.
Attributes inherited from Type
Class Method Summary collapse
Instance Method Summary collapse
- #const_lvalue ⇒ Object
- #const_rvalue ⇒ Object
-
#initialize(type, matcher: Regexp.new("^#{type}$"), header: nil) ⇒ Primitive
constructor
A new instance of Primitive.
- #lvalue ⇒ Object
- #rvalue ⇒ Object
- #to_value ⇒ Object
Methods included from Entity
#<=>, #complexity, #dependencies, #forward_declarations, #implementation, #interface, #position, #references, #total_dependencies, #total_references
Methods inherited from Primitive
#compare, #copy, #custom_create, #default_create, #equal, #hash_code
Methods inherited from Type
abstract, #comparable?, #constructible?, #copy, #copyable?, #custom_constructible?, #custom_create, #default_constructible?, #default_create, #destroy, #destructible?, #hashable?, #inspect, #orderable?, #to_s, #to_type
Constructor Details
#initialize(type, matcher: Regexp.new("^#{type}$"), header: nil) ⇒ Primitive
Returns a new instance of Primitive.
44 45 46 47 48 49 |
# File 'lib/autoc/std.rb', line 44 def initialize(type, matcher: Regexp.new("^#{type}$"), header: nil) super(type) @matcher = matcher dependencies << header unless header.nil? @@types << self end |
Instance Attribute Details
#matcher ⇒ Object (readonly)
Returns the value of attribute matcher.
42 43 44 |
# File 'lib/autoc/std.rb', line 42 def matcher @matcher end |
Class Method Details
.adopt(x) ⇒ Object
37 38 39 40 |
# File 'lib/autoc/std.rb', line 37 def self.adopt(x) @@types.each { |t| return t unless (t.matcher =~ x).nil? } Primitive.new(x) end |
Instance Method Details
#const_lvalue ⇒ Object
59 |
# File 'lib/autoc/std.rb', line 59 def const_lvalue = @clv ||= AutoC::Value.new(self, constant: true, reference: true) |
#const_rvalue ⇒ Object
57 |
# File 'lib/autoc/std.rb', line 57 def const_rvalue = @crv ||= AutoC::Value.new(self, constant: true) |
#lvalue ⇒ Object
55 |
# File 'lib/autoc/std.rb', line 55 def lvalue = @lv ||= AutoC::Value.new(self, reference: true) |
#rvalue ⇒ Object
53 |
# File 'lib/autoc/std.rb', line 53 def rvalue = @rv ||= AutoC::Value.new(self) |
#to_value ⇒ Object
51 |
# File 'lib/autoc/std.rb', line 51 def to_value = rvalue |