class HaveAPI::Fs::Components::MetaInput

Public Class Methods

new(action_dir, *args) click to toggle source
Calls superclass method HaveAPI::Fs::Component::new
# File lib/haveapi/fs/components/meta_input.rb, line 6
def initialize(action_dir, *args)
  super(*args)

  @action_dir = action_dir
end

Public Instance Methods

contents() click to toggle source
# File lib/haveapi/fs/components/meta_input.rb, line 12
def contents
  super + parameters.keys.map(&:to_s)
end
parameters() click to toggle source
# File lib/haveapi/fs/components/meta_input.rb, line 16
def parameters
  @action_dir.action.instance_variable_get('@spec')[:meta][:global][:input][:parameters]
end
title() click to toggle source
# File lib/haveapi/fs/components/meta_input.rb, line 24
def title
  'Input metadata parameters'
end
values() click to toggle source
# File lib/haveapi/fs/components/meta_input.rb, line 20
def values
  Hash[children.select { |n, c| c.is_a?(Parameter) && c.set? }.map { |n, c| [n, c.value] }]
end

Protected Instance Methods

new_child(name) click to toggle source
# File lib/haveapi/fs/components/meta_input.rb, line 29
def new_child(name)
  if child = super
    child

  elsif parameters.has_key?(name)
    [
        Parameter,
        @action_dir.action,
        name,
        :input,
        nil,
        meta: :global,
    ]

  else
    nil
  end
end