Project

iprog_base

0.0
No release in over 3 years
Provides a reusable, extensible base class for service or command objects in Ruby applications, following the Template Method Pattern. Includes lifecycle hooks for parameter handling, static data setup, error checking, data processing, and response filtering. Designed for clean, maintainable, and testable business logic.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies
 Project Readme

iprog_base

Base service/command class using the Template Method Pattern.

Provides a reusable, extensible base class for service or command objects in Ruby applications, following the Template Method Pattern. Includes lifecycle hooks for parameter handling, static data setup, error checking, data processing, and response filtering. Designed for clean, maintainable, and testable business logic.

IPROG TECH

This gem is provided by IPROG TECH, an information technology company specializing in web development services using Ruby on Rails. IPROG TECH also offers free programming tutorials.

Providing Good Quality Web Services:

  • Startup
  • Maintenance
  • Upgrading & Conversion

Buy Me A Coffee

Usage

class UserService < Iprog::Base
  def set_params_data
    set :first_name, params.dig(:first_name)
    set :last_name, params.dig(:last_name)
  end

  def filtered_fields
    [:greet]
  end

  def process_data
    set :greet, "Hello #{@first_name} #{@last_name}"
  end
end

user_service = UserService.call(first_name: "Jhon", last_name: "Doe")

if user_service.success?
  puts user_service.result[:greet]
else
  puts user_service.errors
end