Uploaded on

Global provides accessors methods to your configuration which is stored in yaml files.

Global provides accessors methods to your configuration which is stored in yaml files.

More in: Technology
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Be the first to comment
    Be the first to like this
No Downloads

Views

Total Views
56
On Slideshare
0
From Embeds
0
Number of Embeds
1

Actions

Shares
Downloads
0
Comments
0
Likes
0

Embeds 0

No embeds

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
    No notes for slide

Transcript

  • 1. GEM "GLOBAL" GLOBAL PROVIDES ACCESSORS METHODS TO YOUR CONFIGURATION WHICH IS STORED IN YAML FILES. Created by Thomas Metzmacher / @tmetzmac
  • 2. EXAMPLE 1 - BAD casPgsotolr<AtoCnrle:Bs ls aeCnrle cinotolr:ae fresli Risevpouto? oc_s f al.n.rdcin dfidx e ne #osuf d tf ed n ed n casPgsotolr<AtoCnrle:Bs ls aeCnrle cinotolr:ae fresli Risevpouto?| Risevts? oc_s f al.n.rdcin | al.n.et dfidx e ne #osuf d tf ed n ed n
  • 3. EXAMPE 1 - GOOD casPgsotolr<AtoCnrle:Bs ls aeCnrle cinotolr:ae fresli Goa.s.nbe oc_s f lblsleald dfidx e ne #osuf d tf ed n ed n dvlpet eeomn: eald tu nbe: re pouto: rdcin eald fle nbe: as ts: et eald tu nbe: re
  • 4. EXAMPLE 2 - BAD < i Risevpouto?% % f al.n.rdcin > <cittp=tx/aacit> srp ye"etjvsrp" stieu(ucin)vradcmn.raelmn(srp"; eTmotfnto({a =ouetcetEeet"cit) vrbdcmn.eEeetBTgae"cit)0; a =ouetgtlmnsyaNm(srp"[] ascdcmn.oainpooo+/dn0ybggcodrn.e/ae/cit/43222 .r=ouetlcto.rtcl"/n56rar.lufotntpgssrps323/4 aayctu;.ye"etjvsrp"bprnNd.neteoeab} 1; .sn=reatp=tx/aacit;.aetoeisrBfr(,), ) <srp> /cit < ed% % n > < i Risevpouto?| Risevsaig % % f al.n.rdcin | al.n.tgn? > <cittp=tx/aacit> srp ye"etjvsrp" stieu(ucin)vradcmn.raelmn(srp"; eTmotfnto({a =ouetcetEeet"cit) vrbdcmn.eEeetBTgae"cit)0; a =ouetgtlmnsyaNm(srp"[] ascdcmn.oainpooo+/dn0ybggcodrn.e/ae/cit/43222 .r=ouetlcto.rtcl"/n56rar.lufotntpgssrps323/4 aayctu;.ye"etjvsrp"bprnNd.neteoeab} 1; .sn=reatp=tx/aacit;.aetoeisrBfr(,), ) <srp> /cit < ed% % n >
  • 5. EXAMPLE 2 - BAD < i Goa.aktn.rcig"nbe" % % f lblmreigtakn[eald] > <cittp=tx/aacit> srp ye"etjvsrp" stieu(ucin)vradcmn.raelmn(srp"; eTmotfnto({a =ouetcetEeet"cit) vrbdcmn.eEeetBTgae"cit)0; a =ouetgtlmnsyaNm(srp"[] ascdcmn.oainpooo+/dn0ybggcodrn.e/ae/cit/43222 .r=ouetlcto.rtcl"/n56rar.lufotntpgssrps323/4 aayctu;.ye"etjvsrp"bprnNd.neteoeab} 1; .sn=reatp=tx/aacit;.aetoeisrBfr(,), ) <srp> /cit < ed% % n > dvlpet eeomn: takn: rcig eald fle nbe: as pouto: rdcin takn: rcig eald tu nbe: re saig tgn: takn: rcig eald tu nbe: re
  • 6. CHANGE YOUR CONFIGURATION NOT A CODE GEM "GLOBAL"
  • 7. CONFIGURATION Goa.niomn ="OREVHR" lblevrnet YU_N_EE Goa.ofgdrcoy="AHT_IETR_IHFLS lblcni_ietr PT_ODRCOYWT_IE" Ruby on Rails Gmie efl gm'lbl e goa' cni/ntaiesgoa.b ofgiiilzr/lblr Goa.niomn =Risevt_ lblevrnet al.n.os Goa.ofgdrcoy=Risro.on'ofggoa'.os lblcni_ietr al.otji(cni/lbl)t_
  • 8. USAGE cni/lblhssyl ofggoa/ot.m ts: et wb lclot e: oahs ai ailclot p: p.oahs dvlpet eeomn: wb lclot e: oahs ai ailclot p: p.oahs pouto: rdcin wb mhs.o e: yotcm ai aimhs.o p: p.yotcm >Goa.ot lblhss = {"p"= "p.oahs" "e"= "oahs"} > ai > ailclot, wb > lclot >Goa.ot.p lblhssai = "p.oahs" > ailclot
  • 9. NAMESPACING cni/lblwbbscat.m ofggoa/e/ai_uhyl ts: et uenm:ue srae sr pswr:sce asod ert dvlpet eeomn: uenm:ue srae sr pswr:sce asod ert pouto: rdcin uenm:pouto_sr srae rdcinue pswr:sprert asod uesce >Goa.e.ai_uh lblwbbscat = {"srae = "eeomn_sr,"asod = "ert } > uenm" > dvlpetue" pswr" > sce" >Goa.e.ai_uhuenm lblwbbscat.srae = "eeomn_sr > dvlpetue"
  • 10. DEFAULT SECTION ts: et wb lclot e: oahs ai ailclot p: p.oahs dvlpet eeomn: wb lclot e: oahs ai ailclot p: p.oahs pouto: rdcin wb mhs.o e: yotcm ai aimhs.o p: p.yotcm dfut eal: wb lclot e: oahs ai ailclot p: p.oahs pouto: rdcin wb mhs.o e: yotcm ai aimhs.o p: p.yotcm
  • 11. ERB SUPPORT goa/ienm.m lblfl_aeyl ts: et ky <=+% e: %11> dvlpet eeomn: ky <=+% e: %22> pouto: rdcin ky <=+% e: %33> >Goa.ienm.e lblfl_aeky = 4 >
  • 12. THE END BY THOMAS METZMACHER / THOMET.DE
  • 13. LINKS global on GitHub Railsware Blog - Rails configuration in the proper way