Class: Glib::JsonUi::JsonUiElement
- Inherits:
-
Object
- Object
- Glib::JsonUi::JsonUiElement
- Defined in:
- app/helpers/glib/json_ui/abstract_builder.rb
Direct Known Subclasses
ActionBuilder::Action, ListBuilders::ListTemplate::AbstractTemplate, ListBuilders::TreeTemplate::Standard, MenuBuilder::MenuItem, TableBuilders::Template::AbstractTemplate, ViewBuilder::View
Constant Summary collapse
- @@_required_properties =
{}
Instance Attribute Summary collapse
-
#json ⇒ Object
readonly
Returns the value of attribute json.
-
#page ⇒ Object
readonly
Returns the value of attribute page.
Instance Method Summary collapse
-
#initialize(json, page) ⇒ JsonUiElement
constructor
A new instance of JsonUiElement.
- #props(args = {}) ⇒ Object
Constructor Details
#initialize(json, page) ⇒ JsonUiElement
Returns a new instance of JsonUiElement.
53 54 55 56 |
# File 'app/helpers/glib/json_ui/abstract_builder.rb', line 53 def initialize(json, page) @json = json @page = page end |
Instance Attribute Details
#json ⇒ Object (readonly)
Returns the value of attribute json.
49 50 51 |
# File 'app/helpers/glib/json_ui/abstract_builder.rb', line 49 def json @json end |
#page ⇒ Object (readonly)
Returns the value of attribute page.
49 50 51 |
# File 'app/helpers/glib/json_ui/abstract_builder.rb', line 49 def page @page end |
Instance Method Details
#props(args = {}) ⇒ Object
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'app/helpers/glib/json_ui/abstract_builder.rb', line 58 def props(args = {}) @args = args if args.is_a? Hash args.each do |k, v| send(k, v) end required_properties = @@_required_properties[self.class.component_name] || [] required_properties.each do |prop| raise "Property required: #{prop}. Properties provided: #{args}. Component: #{self.class.component_name}" unless args[prop].present? end else raise "Invalid properties: #{args}" end created end |