Sha256: e2bd6fc3388689ac0503c4e46544b1a1425182dc7b447e174b2882b99f81f042

Contents?: true

Size: 1.04 KB

Versions: 6

Compression:

Stored size: 1.04 KB

Contents

/**
 * Original by Samuel Flores
 *
 * Adds the following new token classes:
 * 		constant, builtin, variable, symbol, regex
 */
Prism.languages.ruby = Prism.languages.extend('clike', {
	'comment': /#[^\r\n]*(\r?\n|$)/,
	'keyword': /\b(alias|and|BEGIN|begin|break|case|class|def|define_method|defined|do|each|else|elsif|END|end|ensure|false|for|if|in|module|new|next|nil|not|or|raise|redo|require|rescue|retry|return|self|super|then|throw|true|undef|unless|until|when|while|yield)\b/,
	'builtin': /\b(Array|Bignum|Binding|Class|Continuation|Dir|Exception|FalseClass|File|Stat|File|Fixnum|Fload|Hash|Integer|IO|MatchData|Method|Module|NilClass|Numeric|Object|Proc|Range|Regexp|String|Struct|TMS|Symbol|ThreadGroup|Thread|Time|TrueClass)\b/,
	'constant': /\b[A-Z][a-zA-Z_0-9]*[?!]?\b/
});

Prism.languages.insertBefore('ruby', 'keyword', {
	'regex': {
		pattern: /(^|[^/])\/(?!\/)(\[.+?]|\\.|[^/\r\n])+\/[gim]{0,3}(?=\s*($|[\r\n,.;})]))/,
		lookbehind: true
	},
	'variable': /[@$]+\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/,
	'symbol': /:\b[a-zA-Z_][a-zA-Z_0-9]*[?!]?\b/
});

Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
polymer-elements-rails-1.0.1 app/assets/components/prism/components/prism-ruby.js
polymer-elements-rails-1.0.0 app/assets/components/prism/components/prism-ruby.js
polymer-elements-rails-1.0.0.pre.rc.1 app/assets/components/prism/components/prism-ruby.js
polymer-iron-rails-1.0.0.pre.rc.3 app/assets/components/prism/components/prism-ruby.js
polymer-iron-rails-1.0.0.pre.rc.2 app/assets/components/prism/components/prism-ruby.js
polymer-iron-rails-1.0.0.pre.rc.1 app/assets/components/prism/components/prism-ruby.js