Iterates through definitions of "#initialize_region", thus implementing
 polymorphic Ruby modules (i.e. page regions).

 Prefer using new modules based on classes.
353218
def initialize_regions
      # regions cacher
      @initialized_regions ||= []
      # get included and extended modules
      modules = self.class.included_modules + (class << self; self end).included_modules
      modules.uniq!
      # initialize each module
      modules.each do |m|
        # check that constructor is defined and we haven't called it before
        next if @initialized_regions.include?(m) || !m.instance_methods.include?(:initialize_region)

        m.instance_method(:initialize_region).bind(self).call
        # cache region
        @initialized_regions << m
      end
    end
490278
def push_scope(definition)
      unless definition.is_a?(RubyLint::Definition::RubyObject)
        raise(
          ArgumentError,
          "Expected a RubyLint::Definition::RubyObject but got " \
            "#{definition.class} instead"
        )
      end

      @scopes << definition
    end
539078
def define_dynamic_queries(roles)
      dynamic_module = Module.new do
        roles.each do |role|
          ["#{role}?".to_sym, "is_#{role}?".to_sym].each do |method|
            define_method(method) { is? role }
          end
        end
      end
      include dynamic_module
    end
1370468
def polymorphic_conditions_for(object_or_type, field, *match)
      match = [:id, :type] if match.blank?
      # Note: {} is equivalent to Hash.new which takes a block, so we must do: ({}) or (Hash.new)
      returning({}) do |conditions|
        conditions.merge!(:"#{field}_id" => object_or_type.id) if object_or_type.is_a?(::ActiveRecord::Base) && match.include?(:id)
        
        if match.include?(:type)
          type = case object_or_type
          when ::Class
            object_or_type.name
          when ::Symbol, ::String
            object_or_type.to_s.singularize.classify
          else # Object - or raise NameError as usual
            object_or_type.class.name
          end
          
          conditions.merge!(:"#{field}_type" => type)
        end
      end
    end
1089120
def set_fragment_html(page_part_key, locale, new_fragment_html)
      # content_key = slug + "_" + page_part_key
      # save in content model associated with page
      page_fragment_content = contents.find_or_create_by(page_part_key: page_part_key)
      content_html_col = "raw_" + locale + "="
      # above is the col used by globalize gem to store localized data
      # page_fragment_content[content_html_col] = fragment_html
      page_fragment_content.send content_html_col, new_fragment_html
      page_fragment_content.save!

      page_fragment_content
    end
746536
def init_region_config(self, region):
        
        self.regions[region] = self.region_config_class(region_name = region, resource_types = self.resource_types)
995666
def define_writer!(k, definition)
      define_method("#{k}=") do |value|
        # Recursively convert hash and array of hash to schematized objects
        value = ensure_schema value, definition[:schema]

        # Initial value
        instance_variable_set "@#{k}", value

        # Dirty tracking
        self.changed_attributes ||= Set.new
        self.changed_attributes << k
      end
    end
318924
function _initModulesOnElement(enabledElement) {
  const modules = store.modules;

  Object.keys(modules).forEach(function(key) {
    if (typeof modules[key].enabledElementCallback === 'function') {
      modules[key].enabledElementCallback(enabledElement);
    }
  });
}
810992
def on_class(node)
      parent      = nil
      parent_node = node.children[1]

      if parent_node
        parent = evaluate_node(parent_node)

        if !parent or !parent.const?
          # FIXME: this should use `definitions` instead.
          parent = current_scope.lookup(:const, 'Object')
        end
      end

      define_module(node, DefinitionBuilder::RubyClass, :parent => parent)
    end
578725
private Object init(Object[] arguments) throws PageException {
	object = Reflector.callConstructor(clazz, arguments);
	isInit = true;
	return object;
    }
315758
def create_new_spec(class_or_module, dry_run, rails_mode, file_path, spec_path)
      # These names are used in ERB template, don't delete.
      # rubocop:disable Lint/UselessAssignment
      methods_to_generate = class_or_module.method_list.select { |m| m.visibility == :public }
      c = class_or_module
      self_path = to_string_value_to_require(file_path)
      # rubocop:enable Lint/UselessAssignment

      erb = RSpecKickstarter::ERBFactory.new(@full_template).get_instance_for_new_spec(rails_mode, file_path)
      code = erb.result(binding)

      if dry_run
        puts "----- #{spec_path} -----"
        puts code
      else
        if File.exist?(spec_path)
          puts "#{spec_path} already exists."
        else
          FileUtils.mkdir_p(File.dirname(spec_path))
          File.open(spec_path, 'w') { |f| f.write(code) }
          puts "#{spec_path} created."
        end
      end
    end
882879
@JRubyMethod
    public static IRubyObject initialize(IRubyObject self) {
        ((RubyObject)self).fastSetInstanceVariable("@tags", RubyHash.newHash(self.getRuntime()));
        return self;
    }
110570
function boot_module() {
    var mtor = function() {};
    mtor.prototype = RubyModule.constructor.prototype;

    function OpalModule() {};
    OpalModule.prototype = new mtor();

    var module = new OpalModule();

    module._id         = unique_id++;
    module._isClass    = true;
    module.constructor = OpalModule;
    module._super      = RubyModule;
    module._methods    = [];
    module.__inc__     = [];
    module.__parent    = RubyModule;
    module._proto      = {};
    module.__mod__     = true;
    module.__dep__     = [];

    return module;
  }
1012248
def readRegions(regions)
      piece = ""
      regions.each do |region|
        # Get the IO for the file with path 'path'. If we are being used in a reactor, this is the IO facade. If we
        # are not then this is a real IO.
        io = @ioManager.get(region.path)
        if ! io
          # No IO for this file. 
          if ! File.exists?(region.path)
            # This file hasn't been created yet by having blocks written to it.
            piece = nil
            break
          end

          raise "This process doesn't have read permission for the file #{region.path}" if ! File.readable?(region.path)

          begin
            io = @ioManager.open(region.path)
          rescue
            @logger.error "Opening file #{region.path} failed: #{$!}"
            raise "Opening file #{region.path} failed"
          end
        end
        io.seek region.offset, IO::SEEK_SET
        begin
          piece << io.read(region.length)
        rescue
          # Error when reading. Likely EOF, meaning this peice isn't all there yet.
          piece = nil
          break
        end
      end
      piece
    end
154890
def polymorphic_belongs_to(*symbols, &block)
        options = symbols.extract_options!
        options.merge!(polymorphic: true)
        belongs_to(*symbols, options, &block)
      end
151393
def Scope(value) # rubocop:disable Naming/MethodName
      case value
      when ObjectInspector::Scope
        value
      else
        ObjectInspector::Scope.new(value)
      end
    end
1183755
def instantiate_modules
      mods = Array(modules)
      mods = load!(mods) if callback?(:load)
      Array(mods).map do |klass|
        init!(klass) || klass.new(fetchable)
      end
    end