...du verbe Drupaler (1er groupe)

settings

Ruby API development: module/class structure to set instance variables via do/block

Please note: the content on this page orginates from ericlondon.com.
In this blog post, I'll show an example Ruby module/class structure to allow users to set configuration settings via a do/block, like:


Api.config do |c|

  c.first_name = 'Eric'
  c.last_name = 'London'

end


The following code shows how a simple module/class structure could be defined to allow end-users to set instance variables on a module's singleton class:
Subscribe to settings