Sha256: ebb78811aae9e56230203fcccaff7c5219b52b1614daaca4a12c62d9340f2529

Contents?: true

Size: 663 Bytes

Versions: 6

Compression:

Stored size: 663 Bytes

Contents

module HowAreWeDoing
  module ActsAsShareable #:nodoc:

    def self.included(base)
      base.extend ClassMethods
    end

    module ClassMethods
      def acts_as_shareable
        has_many :shares, :as => :shareable, :dependent => :nullify
        
        include HowAreWeDoing::ActsAsShareable::InstanceMethods
        extend  HowAreWeDoing::ActsAsShareable::SingletonMethods
      end
    end

    module SingletonMethods
    end

    module InstanceMethods
      def to_share_chart_label(graph_type=nil)
        if respond_to?(:share_chart_label)
          share_chart_label(graph_type)
        else
          to_s
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
how_are_we_doing-0.0.9 lib/how_are_we_doing/acts_as_shareable.rb
how_are_we_doing-0.0.8 lib/how_are_we_doing/acts_as_shareable.rb
how_are_we_doing-0.0.7 lib/how_are_we_doing/acts_as_shareable.rb
how_are_we_doing-0.0.6 lib/how_are_we_doing/acts_as_shareable.rb
how_are_we_doing-0.0.5 lib/how_are_we_doing/acts_as_shareable.rb
how_are_we_doing-0.0.4 lib/acts_as_shareable.rb