Sha256: e3ad038bc7434a8e89912c018c623b82b2ed70b0de811ea167d779530fb57e01

Contents?: true

Size: 564 Bytes

Versions: 12

Compression:

Stored size: 564 Bytes

Contents

module CoffeeTable
  module Utility

    
    # used for setting default options
    def method_missing(method_sym, *arguments, &block)
      if method_sym.to_s =~ /^default_(.*)_to$/
        tag_name = method_sym.to_s.split("_")[1..-2].join("_").to_sym
        @options[tag_name] = arguments[0] unless @options.has_key?(tag_name)
      else
        super
      end
    end

    def underscore(text)
      text.gsub(/::/, '/').
      gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
      gsub(/([a-z\d])([A-Z])/,'\1_\2').
      tr("-", "_").
      downcase
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
coffee_table-0.2.7 lib/coffee_table/utility.rb
coffee_table-0.2.6 lib/coffee_table/utility.rb
coffee_table-0.2.5 lib/coffee_table/utility.rb
coffee_table-0.2.4 lib/coffee_table/utility.rb
coffee_table-0.2.3 lib/coffee_table/utility.rb
coffee_table-0.2.2 lib/coffee_table/utility.rb
coffee_table-0.2.1 lib/coffee_table/utility.rb
coffee_table-0.2.0 lib/coffee_table/utility.rb
coffee_table-0.1.3 lib/coffee_table/utility.rb
coffee_table-0.1.1 lib/coffee_table/utility.rb
coffee_table-0.0.3 lib/utility.rb
coffee_table-0.0.1 lib/utility.rb