{"id":18137969,"url":"https://github.com/rickbutton/safe_nested_calls","last_synced_at":"2025-04-06T17:22:41.399Z","repository":{"id":2554409,"uuid":"3533015","full_name":"rickbutton/safe_nested_calls","owner":"rickbutton","description":"Safely call nested objects in ruby","archived":false,"fork":false,"pushed_at":"2012-02-25T03:04:58.000Z","size":100,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-02-12T23:29:11.966Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rickbutton.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2012-02-24T05:25:44.000Z","updated_at":"2013-11-21T09:35:28.000Z","dependencies_parsed_at":"2022-09-12T11:51:17.429Z","dependency_job_id":null,"html_url":"https://github.com/rickbutton/safe_nested_calls","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickbutton%2Fsafe_nested_calls","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickbutton%2Fsafe_nested_calls/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickbutton%2Fsafe_nested_calls/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rickbutton%2Fsafe_nested_calls/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rickbutton","download_url":"https://codeload.github.com/rickbutton/safe_nested_calls/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247518678,"owners_count":20951846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-01T15:07:51.881Z","updated_at":"2025-04-06T17:22:41.382Z","avatar_url":"https://github.com/rickbutton.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# safe_nested_calls #\n\nThis gem allows you to safely call nested methods \non an object, and not worry about whether or not\nthe methods are defined. It is very useful for \nmanaging dynamically created objects that may not\nhave some methods defined.\n\n# Installation #\n\n    gem install 'safe_nested_calls'\n  \nIf you are using Rails, then it will automatically load \non server start, but if not, somewhere in your code, put:\n\n    require 'safe_nested_calls'\n\n# Usage #\n\nsafe_nested_calls adds two extra methods to Object,\n\t\n  `nested_respond_to?` and `safe_nested_method`.\n\n### nested_respond_to? ###\n\t\t\n\tif object.nested_respond_to?(:one, :two, :three)\n      \nwhich is equivalent to\n\n\tif object.respond_to? :one\n\t\tif object.one.respond_to? :two\n\t\t\tobject.one.two.respond_to? :three\n\n  \n### safe_nested_method ###\n\nThis method can call the actual nested method desired, with optional parameters\n\n    object.safe_nested_method(:one, :two, :three) =\u003e returns object.one.two.three\n      \n\n#### Parameters #####\n\n      \nTo use parameters, use a hash of :method =\u003e args, where args are the method arguments\n\n    object.safe_nested_method(:one =\u003e 1, :two =\u003e [1, 2], :three =\u003e [1,2,3])\n    \n          \nwhich is equivalent to (would throw NoMethodError if a method wasn't defined)\n\n    object.one(1).two(1,2).three(1,2,3)\n\nIf you need to call of mix of methods with and without parameters, set the arguments for \nthe methods without parameters to `:none`\n\n    object.safe_nested_method(:get =\u003e :none, :increment =\u003e 4, :save =\u003e :none)\n      \nwhich is equivalent to (would throw NoMethodError if a method wasn't defined)\n\n    object.get().increment(4).save()\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickbutton%2Fsafe_nested_calls","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frickbutton%2Fsafe_nested_calls","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frickbutton%2Fsafe_nested_calls/lists"}