Class: HaveAPI::Fs::Components::ActionOutput

Inherits:
Directory show all
Defined in:
lib/haveapi/fs/components/action_output.rb

Constant Summary

Constants included from Help

Help::SEARCH_PATH

Instance Attribute Summary collapse

Attributes inherited from HaveAPI::Fs::Component

#atime, #context, #ctime, #mtime

Instance Method Summary collapse

Methods inherited from Directory

#directory?

Methods included from Help

find!, included

Methods inherited from HaveAPI::Fs::Component

#abspath, #bound=, #bound?, children_reader, component, #directory?, #executable?, #file?, #find, inherited, #invalid?, #invalidate, #parent, #path, #readable?, #reset, #setup, #times, #unsaved?, #use, #writable?

Constructor Details

#initialize(action_dir, *args) ⇒ ActionOutput

Returns a new instance of ActionOutput.



7
8
9
10
11
12
13
14
15
# File 'lib/haveapi/fs/components/action_output.rb', line 7

def initialize(action_dir, *args)
  super(*args)

  @action_dir = action_dir

  if %i(hash_list object_list).include?(@action_dir.action.output_layout.to_sym)
    @list = true
  end
end

Instance Attribute Details

#action_dirObject (readonly)

Returns the value of attribute action_dir.



4
5
6
# File 'lib/haveapi/fs/components/action_output.rb', line 4

def action_dir
  @action_dir
end

#dataObject

Returns the value of attribute data.



5
6
7
# File 'lib/haveapi/fs/components/action_output.rb', line 5

def data
  @data
end

Instance Method Details

#contentsObject



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/haveapi/fs/components/action_output.rb', line 17

def contents
  ret = super

  return ret unless @data

  if @list
    ret.concat(@data.map { |v| v.id.to_s })

  else
    ret.concat(parameters.keys.map(&:to_s))
  end

  ret
end

#parametersObject



32
33
34
# File 'lib/haveapi/fs/components/action_output.rb', line 32

def parameters
  @action_dir.action.params
end

#titleObject



36
37
38
# File 'lib/haveapi/fs/components/action_output.rb', line 36

def title
  'Output parameters'
end