diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-17 08:43:50 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2011-06-17 08:43:50 +0200 |
commit | d3cd18269a3e02cdb19af2bc2ea5b6ad159e09b8 (patch) | |
tree | ba07603ab9a557a8c1edce8baa730698c9920a5d | |
parent | d489ca77984f86bc176a0d9aa3c3c7eb784b18c9 (diff) | |
download | zorglub-d3cd18269a3e02cdb19af2bc2ea5b6ad159e09b8.zip zorglub-d3cd18269a3e02cdb19af2bc2ea5b6ad159e09b8.tar.gz |
add Zorglub::Helpers:Css, Zorglub::Helpers:Js
-rw-r--r-- | lib/zorglub/helpers.rb | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/lib/zorglub/helpers.rb b/lib/zorglub/helpers.rb new file mode 100644 index 0000000..668404e --- /dev/null +++ b/lib/zorglub/helpers.rb @@ -0,0 +1,60 @@ +# -*- coding: UTF-8 -*- +# +module Zorglub + # + module Helpers + # + module Js + def self.included mod + # class level instance variables + mod.instance_variable_set :@js, [] + # class accessors + def mod.js *args + unless args.empty? + @js.concat args + @js.uniq! + end + @js + end + end + # instance accessor + def js *args + @js ||=self.class.js.clone + unless args.empty? + @js.concat args + @js.uniq! + end + @js + end + # + end + # + module Css + def self.included mod + # class level instance variables + mod.instance_variable_set :@css, [] + # class accessors + def mod.css *args + unless args.empty? + @css.concat args + @css.uniq! + end + @css + end + end + # instance accessor + def css *args + @css ||=self.class.css.clone + unless args.empty? + @css.concat args + @css.uniq! + end + @css + end + # + end + end + # +end +# +# EOF |