module KnifeAttribute::Helpers

Public Class Methods

attribute_type_map() click to toggle source
# File lib/knife-attribute/helpers.rb, line 5
def self.attribute_type_map
  fail NotImplementedError, "Missing `attribute_types` implementation for current object"
end
default_attribute_type() click to toggle source
# File lib/knife-attribute/helpers.rb, line 9
def self.default_attribute_type
  fail NotImplementedError, "Missing `default_attribute_type` implementation for current object"
end
included(base) click to toggle source
# File lib/knife-attribute/helpers.rb, line 3
def self.included(base)
  base.class_eval do
    def self.attribute_type_map
      fail NotImplementedError, "Missing `attribute_types` implementation for current object"
    end

    def self.default_attribute_type
      fail NotImplementedError, "Missing `default_attribute_type` implementation for current object"
    end
  end
end

Public Instance Methods

attribute() click to toggle source
# File lib/knife-attribute/helpers.rb, line 14
def attribute
  @attribute ||= @name_args[1]
end
attribute_type_map() click to toggle source
# File lib/knife-attribute/helpers.rb, line 34
def attribute_type_map
  self.class.attribute_type_map
end
default_attribute_type() click to toggle source
# File lib/knife-attribute/helpers.rb, line 38
def default_attribute_type
  self.class.default_attribute_type
end
entity() click to toggle source
# File lib/knife-attribute/helpers.rb, line 26
def entity
  @entity = send(entity_type)
end
entity_name() click to toggle source
# File lib/knife-attribute/helpers.rb, line 22
def entity_name
  @entity_name ||= @name_args[0]
end
entity_type() click to toggle source
# File lib/knife-attribute/helpers.rb, line 30
def entity_type
  fail NotImplementedError, "Missing `entity_type` implementation for current object"
end
mapped_config() click to toggle source
# File lib/knife-attribute/helpers.rb, line 42
def mapped_config
  @mapped_config ||= config[:attribute_type] == 'normal' ? {} : {all_attributes: true}
end
value() click to toggle source
# File lib/knife-attribute/helpers.rb, line 18
def value
  @value ||= @name_args[2]
end