23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
# File 'lib/code-box/acts_as_code.rb', line 23
def self.included(base)
unless (class << self; self; end).method_defined?(:_code_box_i18n_model_segment)
instance_eval <<-RUBY_
class << self
def _code_box_i18n_model_segment
nil
end
end
RUBY_
end
instance_eval <<-RUBY_
class << base
def _code_box_i18n_model_segment
return CodeBox.i18n_model_segment if "#{self._code_box_i18n_model_segment}".empty?
"#{self._code_box_i18n_model_segment}"
end
end
RUBY_
base.extend(ClassMethods)
base.acts_as_code(*@opts) if @opts
end
|