module FlightConfig::Accessor::ClassMethods

Public Instance Methods

data_accessor(key) click to toggle source
# File lib/flight_config/accessor.rb, line 61
def data_accessor(key)
  data_reader(key)
  data_writer(key)
end
data_reader(key, &b) click to toggle source
# File lib/flight_config/accessor.rb, line 66
def data_reader(key, &b)
  self.define_method(key) do
    raw = __data__[key]
    b ? instance_exec(raw, &b) : raw
  end
end
data_writer(key, &b) click to toggle source
# File lib/flight_config/accessor.rb, line 73
def data_writer(key, &b)
  self.define_method("#{key}=") do |raw|
    __data__[key] = b ? instance_exec(raw, &b) : raw
  end
end
define_input_methods_from_path_parameters() click to toggle source
# File lib/flight_config/accessor.rb, line 79
def define_input_methods_from_path_parameters
  self.method(:path)
      .parameters
      .select { |type, _| type == :req }
      .each_with_index do |(_, arg), idx|
    define_method(arg) { __inputs__[idx] }
  end
end