Class: Finitio::AliasType
- Defined in:
- lib/finitio/type/alias_type.rb,
lib/finitio/generation/alias_type.rb,
lib/finitio/json_schema/alias_type.rb
Constant Summary
Constants included from Metadata
Instance Attribute Summary collapse
-
#target ⇒ Object
readonly
Returns the value of attribute target.
Instance Method Summary collapse
- #default_name ⇒ Object
- #generate_data(generator, world = nil) ⇒ Object
-
#initialize(target, name, metadata = nil) ⇒ AliasType
constructor
A new instance of AliasType.
- #resolve_proxies(system) ⇒ Object
- #to_json_schema(*args, &bl) ⇒ Object
- #unconstrained ⇒ Object
Methods inherited from Type
#==, #anonymous?, #dress, #include?, #name, #name=, #named?, #suppremum, #to_s
Methods included from Metadata
#metadata, #metadata=, #metadata?
Constructor Details
#initialize(target, name, metadata = nil) ⇒ AliasType
Returns a new instance of AliasType.
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/finitio/type/alias_type.rb', line 4 def initialize(target, name, = nil) unless target.is_a?(Type) raise ArgumentError, "Type expected for target type, got `#{target}`" end if name.nil? raise ArgumentError, "Alias name cannot be nil" end super(name, ) @target = target end |
Instance Attribute Details
#target ⇒ Object (readonly)
Returns the value of attribute target.
15 16 17 |
# File 'lib/finitio/type/alias_type.rb', line 15 def target @target end |
Instance Method Details
#default_name ⇒ Object
17 18 19 |
# File 'lib/finitio/type/alias_type.rb', line 17 def default_name @name end |
#generate_data(generator, world = nil) ⇒ Object
4 5 6 |
# File 'lib/finitio/generation/alias_type.rb', line 4 def generate_data(generator, world = nil) generator.call(target, world) end |
#resolve_proxies(system) ⇒ Object
36 37 38 |
# File 'lib/finitio/type/alias_type.rb', line 36 def resolve_proxies(system) AliasType.new(target.resolve_proxies(system), name, ) end |
#to_json_schema(*args, &bl) ⇒ Object
4 5 6 |
# File 'lib/finitio/json_schema/alias_type.rb', line 4 def to_json_schema(*args, &bl) target.to_json_schema(*args, &bl) end |