Sha256: a1e3563f6f584f99d0a434ac46a39cf24c732c5f69bfcdc75d252b7979709b6f
Contents?: true
Size: 1.42 KB
Versions: 3
Compression:
Stored size: 1.42 KB
Contents
module WLang class EncoderSet # Encoders for ruby module Hosted # Default encoders DEFAULT_ENCODERS = {"main-encoding" => :main_encoding, "single-quoting" => :single_quoting, "double-quoting" => :double_quoting, "regex-escaping" => :regex_escaping, "method-case" => :method_case} # No-op encoding here def self.main_encoding(src, options); src; end # Single-quoting encoding def self.single_quoting(src, options); src.gsub(/([^\\])'/,%q{\1\\\'}); end # Double-quoting encoding def self.double_quoting(src, options); src.gsub('"','\"'); end # Regexp-escaping encoding def self.regex_escaping(src, options); Regexp.escape(src); end # Converts any source to a typical ruby method name def self.method_case(src, options) src.strip.gsub(/[^a-zA-Z0-9\s]/," "). gsub(/([A-Z])/){ " " + $1.downcase}. strip. gsub(/^([^a-z])/){ "_" + $1 }. gsub(/\s+/){"_"} end end # module Hosted end class RuleSet # Defines rulset of the wlang/ruby dialect module Hosted # Default mapping between tag symbols and methods DEFAULT_RULESET = {} end # module Hosted end # class RuleSet end # module WLang
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
wlang-0.10.2 | lib/wlang/dialects/hosted_dialect.rb |
wlang-0.10.1 | ./lib/wlang/dialects/hosted_dialect.rb |
wlang-0.10.0 | lib/wlang/dialects/hosted_dialect.rb |