Module: Engine2::ActionAPISupport
- Included in:
- ActionFormSupport, ActionListSupport, Engine2::ActionOnChangeSupport::OnChangeAction, ActionViewSupport, DecodeAction, InfraAction
- Defined in:
- lib/engine2/action.rb
Instance Method Summary collapse
- #config ⇒ Object
- #decorate(list) ⇒ Object
- #field_filter(*flds, filter) ⇒ Object
- #hide_fields(*flds) ⇒ Object
- #info(field) ⇒ Object
- #info!(*fields, options) ⇒ Object
- #loc!(hash) ⇒ Object
- #render(field, options) ⇒ Object
- #show_fields(*flds) ⇒ Object
Instance Method Details
#config ⇒ Object
229 230 231 |
# File 'lib/engine2/action.rb', line 229 def config [:config] ||= {} end |
#decorate(list) ⇒ Object
244 245 246 247 248 |
# File 'lib/engine2/action.rb', line 244 def decorate list list.each do |f| info(f)[:loc] ||= LOCS[f.to_sym] end end |
#field_filter(*flds, filter) ⇒ Object
262 263 264 |
# File 'lib/engine2/action.rb', line 262 def field_filter *flds, filter info! *flds, filter: filter end |
#hide_fields(*flds) ⇒ Object
254 255 256 |
# File 'lib/engine2/action.rb', line 254 def hide_fields *flds info! *flds, hidden: true end |
#info(field) ⇒ Object
225 226 227 |
# File 'lib/engine2/action.rb', line 225 def info field ([:info] ||= {})[field.to_sym] ||= {} end |
#info!(*fields, options) ⇒ Object
233 234 235 236 237 238 |
# File 'lib/engine2/action.rb', line 233 def info! *fields, raise E2Error.new("No fields given to info") if fields.empty? fields.each do |field| info(field).merge! # rmerge ? end end |
#loc!(hash) ⇒ Object
240 241 242 |
# File 'lib/engine2/action.rb', line 240 def loc! hash ([:loc] ||= {}).merge! hash end |
#render(field, options) ⇒ Object
250 251 252 |
# File 'lib/engine2/action.rb', line 250 def render field, info! field, render: end |
#show_fields(*flds) ⇒ Object
258 259 260 |
# File 'lib/engine2/action.rb', line 258 def show_fields *flds info! *flds, hidden: false end |