module Consul::Power::DynamicAccess::InstanceMethods

Public Instance Methods

for_model(*args) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 59
def for_model(*args)
  send(name_for_model(*args))
end
include!(power_name, *args) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 16
def include!(power_name, *args)
  warn "makandra/consul: #include! is deprececated. Use #include_power! and #include_object! instead."
  if args.size == 0
    include_power!(power_name, *args)
  else
    include_object!(power_name, *args)
  end
end
include?(power_name, *args) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 7
def include?(power_name, *args)
  warn "makandra/consul: #include? is deprececated. Use #include_power? and #include_object? instead."
  if args.size == 0
    include_power?(power_name, *args)
  else
    include_object?(power_name, *args)
  end
end
include_model!(*args) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 67
def include_model!(*args)
  include_power!(name_for_model(*args))
end
include_model?(*args) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 63
def include_model?(*args)
  include_power?(name_for_model(*args))
end
include_object!(power_name, *context_and_object) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 38
def include_object!(power_name, *context_and_object)
  power_name = power_name.to_s
  send("#{singularize_power_name(power_name)}!", *context_and_object)
end
include_object?(power_name, *context_and_object) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 33
def include_object?(power_name, *context_and_object)
  power_name = power_name.to_s
  send("#{singularize_power_name(power_name)}?", *context_and_object)
end
include_power!(power_name, *context) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 29
def include_power!(power_name, *context)
  send("#{power_name}!", *context)
end
include_power?(power_name, *context) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 25
def include_power?(power_name, *context)
  send("#{power_name}?", *context)
end
include_record!(*args) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 48
def include_record!(*args)
  adjective, record = Util.adjective_and_argument(*args)
  include_object!(name_for_model(adjective, record.class), record)
end
include_record?(*args) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 43
def include_record?(*args)
  adjective, record = Util.adjective_and_argument(*args)
  include_object?(name_for_model(adjective, record.class), record)
end
name_for_model(*args) click to toggle source
# File lib/consul/power/dynamic_access.rb, line 53
def name_for_model(*args)
  adjective, model_class = Util.adjective_and_argument(*args)
  collection_name = model_class.name.underscore.gsub('/', '_').pluralize
  [adjective, collection_name].select(&:present?).join('_')
end