Sha256: a9f66b4e0556d0bf3dde33ac4f0982fa51525a28c56cd137c7bf57e2656e1e22

Contents?: true

Size: 603 Bytes

Versions: 1

Compression:

Stored size: 603 Bytes

Contents

module WorldFlagsHelper
	def self.flag_sizes
		[16, 32]
	end

	def flags_list size = 16, &block
		raise "Missing block" unless block_given?
		raise "Supported sizes are only #{WorldFlagsHelper.flag_sizes}" unless WorldFlagsHelper.flag_sizes.include?(size.to_i)
		content_tag :ul, yield, :class => "f#{size}"
	end

	def flags flags_hash
		flags_hash.inject("") do |res, element|
			res << flag(element.first, element.last)
		end.html_safe
	end

	def flag code, name
		content_tag :li,  name.html_safe, :class => "flag #{code}"
	end

	def use_flags size = 16
		stylesheet_link_tag "flags#{size}"
	end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
world-flags-0.1.1 lib/world_flags/world_flags_helper.rb