Module: Card::View::Stub
- Included in:
- Card::View
- Defined in:
- lib/card/view/stub.rb
Overview
A "stub" is a placeholder for a card view. It can only be used in situations where the card identifier, known options, and nest mode comprise all the info needed to reproduce the view as intended
Instance Method Summary collapse
Instance Method Details
#stub ⇒ Object
7 8 9 |
# File 'lib/card/view/stub.rb', line 7 def stub "<card-view>#{stub_json}</card-view>" end |
#stub_hash ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/card/view/stub.rb', line 15 def stub_hash { cast: card.cast, options: , mode: format.mode } end |
#stub_json ⇒ Object
11 12 13 |
# File 'lib/card/view/stub.rb', line 11 def stub_json JSON.generate stub_hash end |
#validate_stub ⇒ Object
23 24 25 26 27 |
# File 'lib/card/view/stub.rb', line 23 def validate_stub return if .empty? raise "INVALID STUB: #{card.name}/#{ok_view}" \ " has foreign options: #{}" end |