Class: LatoCore::Cell

Inherits:
Cell::Concept
  • Object
show all
Includes:
ActionView::Helpers::JavaScriptHelper, ActionView::Helpers::OutputSafetyHelper, ActionView::Helpers::SanitizeHelper, ActionView::Helpers::UrlHelper, Cell::Erb, ERB::Util
Defined in:
lib/lato_core/cell.rb

Instance Method Summary collapse

Instance Method Details

#validate_args(args: {}, requested_args: [], default_args: {}) ⇒ Object

This function is used from cells to validates arguments on constructor.



17
18
19
20
21
22
23
24
25
26
27
# File 'lib/lato_core/cell.rb', line 17

def validate_args(args: {}, requested_args: [], default_args: {})
  requested_args.each do |requested_arg|
    raise "Cell must have #{requested_arg} argument" if args[requested_arg] == nil
  end

  default_args.each do |key, value|
    args[key] = value if args[key] == nil
  end

  args
end