Sha256: 4e44ee5881ece35e12861168df63db221d171f56597eb716b72aa173c7d57902
Contents?: true
Size: 1.01 KB
Versions: 16
Compression:
Stored size: 1.01 KB
Contents
# frozen_string_literal: true class Sinclair class MethodBuilder # @api private # @author darthjee # # Class responsible to build methods from # string definitions # # @see MethodDefinition::StringDefinition class StringMethodBuilder < Base # Builds the method # # @return (see Base#build) def build klass.module_eval(code_definition, __FILE__, __LINE__ + 1) end private # @private # # string used for method name definition # # the string changes depending if it is # a class or instance method # # @return [String] def definition_name instance? ? name : "self.#{name}" end # @private # # string with the code to be defined # # @return [String] def code_definition <<-CODE def #{definition_name} #{code_line} end CODE end delegate :code_line, :name, to: :definition end end end
Version data entries
16 entries across 16 versions & 1 rubygems