lib/neo/rails/exposure.rb in neo-rails-0.0.1 vs lib/neo/rails/exposure.rb in neo-rails-0.0.2

- old
+ new

@@ -1,5 +1,7 @@ +require 'active_support/concern' + module Neo module Rails # A really simple version of exposing variables to the view. # Bases on attr_reader and helper_method. module Exposure @@ -7,16 +9,16 @@ class UndeclaredVariableError < StandardError; end included do class_attribute :exposed_vars - self.exposed_vars = Set.new + self.exposed_vars ||= Set.new end module ClassMethods # Defines the variables to be exposed. def exposes(*names) - exposures = names.map(&:to_sym).reject { |name| exposed_vars.include?(name) } + exposures = names.map(&:to_sym) self.exposed_vars.merge exposures attr_reader *exposures helper_method *exposures end end