Class: HaveAPI::Fs::Components::ResourceActionDir
- Inherits:
-
Directory
- Object
- HaveAPI::Fs::Component
- Directory
- HaveAPI::Fs::Components::ResourceActionDir
- Defined in:
- lib/haveapi/fs/components/resource_action_dir.rb
Constant Summary
Constants included from Help
Instance Attribute Summary collapse
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
Attributes inherited from HaveAPI::Fs::Component
#atime, #context, #ctime, #mtime
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(r) ⇒ ResourceActionDir
constructor
A new instance of ResourceActionDir.
- #instance? ⇒ Boolean
- #relevant_actions ⇒ Object
- #title ⇒ Object
Methods inherited from Directory
Methods included from Help
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(r) ⇒ ResourceActionDir
Returns a new instance of ResourceActionDir.
6 7 8 9 10 11 |
# File 'lib/haveapi/fs/components/resource_action_dir.rb', line 6 def initialize(r) @resource = r @instance = r.is_a?(HaveAPI::Client::ResourceInstance) || r.is_a?(HaveAPI::Fs::HashWrapper) super() end |
Instance Attribute Details
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
4 5 6 |
# File 'lib/haveapi/fs/components/resource_action_dir.rb', line 4 def resource @resource end |
Instance Method Details
#contents ⇒ Object
13 14 15 |
# File 'lib/haveapi/fs/components/resource_action_dir.rb', line 13 def contents super + relevant_actions.map(&:to_s) end |
#instance? ⇒ Boolean
37 38 39 |
# File 'lib/haveapi/fs/components/resource_action_dir.rb', line 37 def instance? @instance end |
#relevant_actions ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/haveapi/fs/components/resource_action_dir.rb', line 17 def relevant_actions return @actions if @actions @actions = [] @resource.actions.each do |name, a| pos = a.url.index(":#{@resource._name}_id") if @instance cond = pos else cond = pos.nil? end @actions << name if cond end @actions end |
#title ⇒ Object
41 42 43 |
# File 'lib/haveapi/fs/components/resource_action_dir.rb', line 41 def title 'Actions' end |