Sha256: bdb4b034baa5a066928b25570b7e09bb504bd86cb2b247cee5445c8e64211e1c

Contents?: true

Size: 678 Bytes

Versions: 1

Compression:

Stored size: 678 Bytes

Contents

require "go_social/version"

module GoSocial

  def self.names
    #%w{pinit tweet like google_plus}
    %w{facebook pinterest twitter}
  end

  def self.config name = nil, &block
    context = name ? "GoSocial::#{name.to_s.camelize}".constantize : self
    block_given? ? yield(context) : context
  end

  # add class method for each social widgets registered
  names.each do |name|
    (class << self; self; end).send :define_method, name do |&block|
      clazz = "GoSocial::#{name.to_s.camelize}".constantize
      block_given? ? clazz.instance_eval(&block) : clazz
    end
  end

end

require "go_social/view_helper"
require "go_social/engine" if defined?(::Rails::Engine)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
go_social-0.0.1 lib/go_social.rb~