From d3cd18269a3e02cdb19af2bc2ea5b6ad159e09b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 17 Jun 2011 08:43:50 +0200 Subject: add Zorglub::Helpers:Css, Zorglub::Helpers:Js --- lib/zorglub/helpers.rb | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 lib/zorglub/helpers.rb 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 -- cgit v1.1-2-g2b99