Class: Command::OgCommands::DisplayCommand
- Inherits:
-
Command
- Object
- Command
- Command::OgCommands::DisplayCommand
show all
- Defined in:
- lib/command-set/og.rb
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Command
raw_stderr, raw_stdout, wrap_stderr, wrap_stdout
Class Method Details
.many_relations(list) ⇒ Object
306
307
308
309
310
311
312
313
314
|
# File 'lib/command-set/og.rb', line 306
def many_relations(list)
define_method(:many_relations) do
fields = {}
list.each do |name, field_name|
fields[name] = entity.__send__("count_#{field_name}")
end
return fields
end
end
|
.simple_fields(list) ⇒ Object
281
282
283
284
285
286
287
288
289
|
# File 'lib/command-set/og.rb', line 281
def simple_fields(list)
define_method(:simple_fields) do
fields = {}
list.each do |name, field_name|
fields[name] = entity.__send__(field_name)
end
return fields
end
end
|
.single_relations(list) ⇒ Object
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
# File 'lib/command-set/og.rb', line 291
def single_relations(list)
define_method(:single_relations) do
fields = {}
list.each do |name, field_name, called|
target = entity.__send__(field_name)
if target.nil?
fields[name] = ""
else
fields[name] = target.__send__(called)
end
end
return fields
end
end
|
Instance Method Details
#entity ⇒ Object
276
277
278
|
# File 'lib/command-set/og.rb', line 276
def entity
subject.current_state.last
end
|
#many_relations ⇒ Object
272
273
274
|
# File 'lib/command-set/og.rb', line 272
def many_relations
{}
end
|
#simple_fields ⇒ Object
264
265
266
|
# File 'lib/command-set/og.rb', line 264
def simple_fields
{}
end
|
#single_relations ⇒ Object
268
269
270
|
# File 'lib/command-set/og.rb', line 268
def single_relations
{}
end
|