Module: EasyType::Parameter::ClassMethods

Defined in:
lib/easy_type/parameter.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) on_apply(&block)

on_apply do

    "identified by #{resource[:password]}"
  end
end

Parameters:

  • block (Method) —

    The code to be run on creating or modifying a resource. Although the code customary returns just a string that is appended to the command, it can do anything that is deemed nesceccary.

See Also:

  • For information on creating a resource
  • For information on modifying an existing resource


35
36
37
# File 'lib/easy_type/parameter.rb', line 35

def on_apply(&block)
	define_method(:on_apply, &block) if block
end

- (Object) to_translate_to_resource(&block)

map do

   "identified by #{resource[:password]}"
  end
end

Parameters:

  • block (Method) —

    The code to be run to pick a part of the raw_hash and use it as the value of this parameter or property.



53
54
55
56
# File 'lib/easy_type/parameter.rb', line 53

def to_translate_to_resource(&block)
	eigenclass = class << self; self; end
	eigenclass.send(:define_method, :translate_to_resource, &block)
end