Class: Supa::Builder
- Inherits:
-
Object
- Object
- Supa::Builder
- Defined in:
- lib/supa/builder.rb
Constant Summary collapse
- COMMANDS_WITH_DEFAULT_INTERFACE =
%w(attribute virtual object namespace collection append).freeze
Instance Method Summary collapse
- #attributes(*names, **options) ⇒ Object
-
#initialize(subject, representer:, tree:) ⇒ Builder
constructor
A new instance of Builder.
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(subject, representer:, tree:) ⇒ Builder
Returns a new instance of Builder.
5 6 7 8 9 |
# File 'lib/supa/builder.rb', line 5 def initialize(subject, representer:, tree:) @subject = subject @representer = representer @tree = tree end |
Instance Method Details
#attributes(*names, **options) ⇒ Object
24 25 26 27 28 |
# File 'lib/supa/builder.rb', line 24 def attributes(*names, **) Supa::Commands::Attributes.new( @subject, representer: @representer, tree: @tree, name: names, options: ).represent end |
#to_hash ⇒ Object
30 31 32 |
# File 'lib/supa/builder.rb', line 30 def to_hash @tree.to_hash end |
#to_json ⇒ Object
34 35 36 |
# File 'lib/supa/builder.rb', line 34 def to_json to_hash.to_json end |