Skip to content

Conversation

mistersourcerer
Copy link

This PR adds the ability to create a settings class with a nested namespace, so the "base hash" can be fetched from inside some yaml key.

  # /some/file/here.yml
  professional:
    preferences:
      order: desc
  client:
    prefs:
      order: asc

  class ProfessionalPreferences < Settingslogic
    source "/some/file/here.yml"
    namespace "professional.preferences"
  end
  >> ProfessionalPreferences.order
  => "desc"

… any hash.

you can pass a block to say what need to be done when a key isn't in the hash.
  # /some/file/here.yml
  professional:
    preferences:
      order: desc
  client:
    prefs:
      order: asc

  class ProfessionalPreferences < Settingslogic
    source "/some/file/here.yml"
    namespace "professional.preferences"
  end

  >> ProfessionalPreferences.order
  => "desc"
@zhouguangming
Copy link

+1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants