Class: OpenUSD::Schema::Base
- Inherits:
-
Object
- Object
- OpenUSD::Schema::Base
- Defined in:
- lib/openusd/schema/base.rb
Overview
Base for typed convenience wrappers around Stage prims.
Class Attribute Summary collapse
-
.type_name ⇒ Object
readonly
Returns the value of attribute type_name.
Instance Attribute Summary collapse
-
#prim ⇒ Object
readonly
Returns the value of attribute prim.
Class Method Summary collapse
-
.define(stage, path) ⇒ Base
Define and wrap a prim.
-
.get(stage, path) ⇒ Base?
Wrap a prim only when its type matches.
-
.schema_type(name) ⇒ Object
private
Declare the prim type represented by a wrapper.
Instance Method Summary collapse
-
#initialize(prim) ⇒ Base
constructor
A new instance of Base.
-
#path ⇒ Path
Wrapped prim path.
-
#stage ⇒ Stage
Owning stage.
Constructor Details
#initialize(prim) ⇒ Base
Returns a new instance of Base.
35 36 37 |
# File 'lib/openusd/schema/base.rb', line 35 def initialize(prim) @prim = prim end |
Class Attribute Details
.type_name ⇒ Object (readonly)
Returns the value of attribute type_name.
9 10 11 |
# File 'lib/openusd/schema/base.rb', line 9 def type_name @type_name end |
Instance Attribute Details
#prim ⇒ Object (readonly)
Returns the value of attribute prim.
33 34 35 |
# File 'lib/openusd/schema/base.rb', line 33 def prim @prim end |
Class Method Details
.define(stage, path) ⇒ Base
Define and wrap a prim.
19 20 21 |
# File 'lib/openusd/schema/base.rb', line 19 def define(stage, path) new(stage.define_prim(path, type_name)) end |
.get(stage, path) ⇒ Base?
Wrap a prim only when its type matches.
25 26 27 28 29 30 |
# File 'lib/openusd/schema/base.rb', line 25 def get(stage, path) prim = stage.prim_at(path) return unless prim&.type_name == type_name new(prim) end |
.schema_type(name) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Declare the prim type represented by a wrapper.
13 14 15 |
# File 'lib/openusd/schema/base.rb', line 13 def schema_type(name) @type_name = name.freeze end |