Module: RubyLess
- Included in:
- StringDictionary
- Defined in:
- lib/ruby_less.rb,
lib/ruby_less/info.rb,
lib/ruby_less/error.rb,
lib/ruby_less/processor.rb,
lib/ruby_less/safe_class.rb,
lib/ruby_less/syntax_error.rb,
lib/ruby_less/typed_method.rb,
lib/ruby_less/typed_string.rb,
lib/ruby_less/signature_hash.rb,
lib/ruby_less/no_method_error.rb
Defined Under Namespace
Modules: SafeClass
Classes: Error, NoMethodError, RubyLessProcessor, SignatureHash, SyntaxError, TypedMethod, TypedString
Constant Summary
collapse
- VERSION =
'0.8.11'
Class Method Summary
collapse
Class Method Details
.included(base) ⇒ Object
14
15
16
17
18
|
# File 'lib/ruby_less.rb', line 14
def self.included(base)
base.class_eval do
include SafeClass
end
end
|
.safe_method_type_for(klass, signature) ⇒ Object
Return method type (options) if the given signature is a safe method for the class.
.translate(receiver, string) ⇒ Object
25
26
27
28
29
30
31
32
33
34
35
|
# File 'lib/ruby_less.rb', line 25
def self.translate(receiver, string)
RubyLessProcessor.translate(receiver, string)
rescue Exception => err
if err.kind_of?(RubyLess::Error)
raise err
else
raise RubyLess::Error.new("Error parsing \"#{string}\": #{err.message.strip}")
end
end
|
.translate_string(receiver, string) ⇒ Object
37
38
39
40
41
42
43
44
45
46
47
48
49
|
# File 'lib/ruby_less.rb', line 37
def self.translate_string(receiver, string)
if string =~ /\#\{/
translate(receiver, "%Q{#{string}}")
else
TypedString.new(string.inspect, :class => String, :literal => string)
end
rescue Exception => err
if err.kind_of?(RubyLess::Error)
raise err
else
raise RubyLess::Error.new("Error parsing string \"#{string}\": #{err.message.strip}")
end
end
|