クラスヘルパー

インスタンスには２つのプロパティが追加される
props: プロパティ設定
tpl  : テンプレート

@method ClassHelper
@param  {String}       name       クラス名
@param  {Object}       properties プロパティ
@param  {String|Array} template   テンプレート (任意)
配列の場合は要素ごとに改行されます
552045
function ClassHelper (name, properties, template) {
  // props
  if (!properties) {
    throw new Error('ヘルパーを作成できません。プロパティの設定が存在しません');
  }
  this.name = name || '';
  this.props = properties;
  // template
  this.tpl = null;
  if (typeof template === 'string') {
    this.tpl = template.split(EOL);
  } else if (Array.isArray(template)) {
    this.tpl = template;
  }
}
370085
function(name, extendee) {
      // build side-chained lists to optimize iterations
      this.optimizePropertyMaps(this.prototype);
      this.createPropertyAccessors(this.prototype);
      // install mdv delegate on template
      this.installBindingDelegate(this.fetchTemplate());
      // install external stylesheets as if they are inline
      this.installSheets();
      // adjust any paths in dom from imports
      this.resolveElementPaths(this);
      // compile list of attributes to copy to instances
      this.accumulateInstanceAttributes();
      // parse on-* delegates declared on `this` element
      this.parseHostEvents();
      //
      // install a helper method this.resolvePath to aid in 
      // setting resource urls. e.g.
      // this.$.image.src = this.resolvePath('images/foo.png')
      this.addResolvePathApi();
      // under ShadowDOMPolyfill, transforms to approximate missing CSS features
      if (hasShadowDOMPolyfill) {
        WebComponents.ShadowCSS.shimStyling(this.templateContent(), name,
          extendee);
      }
      // allow custom element access to the declarative context
      if (this.prototype.registerCallback) {
        this.prototype.registerCallback(this);
      }
    }
648531
public void templateModem_name_DELETE(String name) throws IOException {
		String qPath = "/xdsl/templateModem/{name}";
		StringBuilder sb = path(qPath, name);
		exec(qPath, "DELETE", sb.toString(), null);
	}
19448
function(name, eagerCompile, cb) {
                if (name && name.raw) {
                    // this fixes autoescape for templates referenced in symbols
                    name = name.raw;
                }

                if (lib.isFunction(eagerCompile)) {
                    cb = eagerCompile;
                    eagerCompile = false;
                }

                if (typeof name !== 'string') {
                    throw new Error('template names must be a string: ' + name);
                }

                var tmpl = this.cache[name];

                if (tmpl) {
                    if (eagerCompile) {
                        tmpl.compile();
                    }

                    if (cb) {
                        cb(null, tmpl);
                    } else {
                        return tmpl;
                    }
                } else {
                    var syncResult;

                    lib.asyncIter(this.loaders, function(loader, i, next, done) {
                        function handle(src) {
                            if (src) {
                                done(src);
                            } else {
                                next();
                            }
                        }

                        if (loader.async) {
                            loader.getSource(name, function(err, src) {
                                if (err) {
                                    throw err;
                                }
                                handle(src);
                            });
                        } else {
                            handle(loader.getSource(name));
                        }
                    }, function(info) {
                        if (!info) {
                            var err = new Error('template not found: ' + name);
                            if (cb) {
                                cb(err);
                            } else {
                                throw err;
                            }
                        } else {
                            var tmpl = new Template(info.src, this,
                                info.path, eagerCompile);

                            if (!info.noCache) {
                                this.cache[name] = tmpl;
                            }

                            if (cb) {
                                cb(null, tmpl);
                            } else {
                                syncResult = tmpl;
                            }
                        }
                    }.bind(this));

                    return syncResult;
                }
            }
829636
public void setProperty(final String name, final String val) {
    if (props == null) {
      props = new Properties();
    }

    props.setProperty(name, val);
  }
960777
def add_child(name, opts = {}, &block)
      delete_property(name)
      properties << ChildDeclaration.new(name, opts.delete(:class), opts, &block)
    end
1226108
def template_class_from_name(name):
    
    # import the right template module
    term = TerminalView()
    template_name = name + 'Template'
    try:
        __import__('projy.templates.' + template_name)
        template_mod = sys.modules['projy.templates.' + template_name]
    except ImportError:
        term.print_error_and_exit("Unable to find {}".format(name))

    # import the class from the module
    try:
        template_class = getattr(template_mod, template_name)
    except AttributeError:
        term.print_error_and_exit("Unable to create a template {}".format(name))
    return template_class()
548004
function (node, name) {
    var propertyInfo = DOMProperty.properties.hasOwnProperty(name) ? DOMProperty.properties[name] : null;
    if (propertyInfo) {
      var mutationMethod = propertyInfo.mutationMethod;
      if (mutationMethod) {
        mutationMethod(node, undefined);
      } else if (propertyInfo.mustUseProperty) {
        var propName = propertyInfo.propertyName;
        if (propertyInfo.hasBooleanValue) {
          node[propName] = false;
        } else {
          node[propName] = '';
        }
      } else {
        node.removeAttribute(propertyInfo.attributeName);
      }
    } else if (DOMProperty.isCustomAttribute(name)) {
      node.removeAttribute(name);
    }

    if ("development" !== 'production') {
      ReactInstrumentation.debugTool.onHostOperation(ReactDOMComponentTree.getInstanceFromNode(node)._debugID, 'remove attribute', name);
    }
  }
240020
private void generateTemplateExpressionMethod(ComponentExposedTypeGenerator exposedTypeGenerator,
      TemplateExpression expression,
      String templateName) {
    MethodSpec.Builder templateExpressionMethodBuilder = MethodSpec
        .methodBuilder(expression.getId())
        .addModifiers(Modifier.PUBLIC)
        .addAnnotation(JsMethod.class)
        .addAnnotation(getUnusableByJSAnnotation())
        .returns(expression.getType());

    String expressionPosition = templateName;
    if (expression.getLineInHtml() != null) {
      expressionPosition += ", line " + expression.getLineInHtml();
    }

    templateExpressionMethodBuilder.addComment(expressionPosition);

    expression
        .getParameters()
        .forEach(parameter -> templateExpressionMethodBuilder.addParameter(parameter.getType(),
            parameter.getName()));

    if (expression.isReturnString()) {
      templateExpressionMethodBuilder.addStatement("return $T.templateExpressionToString($L)",
          VueGWTTools.class,
          expression.getBody());
    } else if (expression.isReturnVoid()) {
      templateExpressionMethodBuilder.addStatement("$L", expression.getBody());
    } else if (expression.isReturnAny()) {
      templateExpressionMethodBuilder.addStatement("return $T.asAny($L)",
          Js.class,
          expression.getBody());
    } else if (expression.isShouldCast()) {
      templateExpressionMethodBuilder.addStatement("return ($T) ($L)",
          expression.getType(),
          expression.getBody());
    } else {
      templateExpressionMethodBuilder.addStatement("return $L", expression.getBody());
    }

    exposedTypeGenerator.getClassBuilder().addMethod(templateExpressionMethodBuilder.build());
    exposedTypeGenerator.addMethodToProto(expression.getId());
  }
631367
function mergeArgumentsTemplate(template, arg, propertyName) {
  if (!template.hasOwnProperty(propertyName)) {
    template[propertyName] = {};
  }

  if (arg.hasOwnProperty(propertyName)) {

    if (!arg[propertyName]) {
      arg[propertyName] = {};
    }

    Object.keys(arg[propertyName]).forEach((key) => {
      if (template[propertyName].hasOwnProperty(key)) {
        throw new Error(propertyName + ' name used more than once: ' + key);
      }

      template[propertyName][key] = JSON.parse(JSON.stringify(arg[propertyName][key]));
    });
  }
}
707230
def generic_objects_for_object_template(name, params = {})
      api_call(:get, "/object_templates/#{name}/generic_objects", params) do |response|
         Calculated::Models::ObjectTemplate.new(response["object_template"])
      end
    end
915132
function addComponent(name) {
  const source = path.join(packages, '.template');
  const destination = path.join(packages, name);

  if (fs.existsSync(destination)) {
    console.log(chalk.red('error'), 'Component package exists');
  } else {
    ncp(source, destination, error => {
      if (error) {
        console.log(chalk.red('error'), error);
      } else {
        const items = walk(destination, { nodir: true });

        items.forEach(item => {
          const string = fs.readFileSync(item.path, 'utf8');
          const template = Handlebars.compile(string);
          const data = template({ component: name });

          fs.writeFileSync(item.path, data, 'utf8');
        });

        console.log(chalk.green('success'), 'Added new component');
        execSync('yarn postinstall');
        updateDemo(name);
      }
    });
  }
}
513142
function XTemplate(tpl, config) {
  var tplType = (typeof tpl);
  if (tplType !== 'string' && tplType !== 'function') {
    config = tpl;
    tpl = undefined;
  }
  config = this.config = util.merge(XTemplate.globalConfig, config);
  if (tplType === 'string') {
    try {
      tpl = this.compile(tpl, config.name);
    } catch (err) {
      this.compileError = err;
    }
  }
  XTemplateRuntime.call(this, tpl, config);
}
281093
private void initKeyVariable(String name, TemplateParserContext context) {
    this.keyVariableInfo = context.addLocalVariable("String", name.trim());
  }
218508
function(props) {
        var files = {};
        // Include all template files by default.
        helpers.expand({filter: 'isFile', dot: true}, [pathPrefix + '**']).forEach(function(obj) {
          // Get the source filepath relative to the template root.
          var src = obj.rel.slice(pathPrefix.length);
          // Get the destination filepath.
          var dest = init.renames[src];
          // Create a property for this file, but use src if dest evaulates
          // to false
          var processed = (dest) ? grunt.template.process(dest, {data: props, delimiters: 'init'}) : false;
          processed = (processed === 'false' || processed === '') ? false : processed;
          files[(processed) ? processed : src] = obj.rel;
        });
        // Exclude files with a value of false in rename.json.
        var exclusions = Object.keys(init.renames).filter(function(key) {
          var processed = (init.renames[key]) ? 
            grunt.template.process(init.renames[key], {data: props, delimiters: 'init'}) : false;
          processed = (processed === 'false' || processed === '') ? false : processed;
          return (processed === false);
        }).map(function(key) {
          return pathPrefix + key;
        });
        // Exclude all exclusion files by deleting them from the files object.
        if (exclusions.length > 0) {
          helpers.expand({filter: 'isFile', dot: true}, exclusions).forEach(function(obj) {
            // Get the source filepath relative to the template root.
            var src = obj.rel.slice(pathPrefix.length);
            // And remove that file from the files list.
            delete files[src];
          });
        }
        return files;
      }
169172
function(property_name) {

		if (!(property_name in this._data_bindings_by_property)) {

			this._data_bindings_by_property[property_name] = new Lava.scope.DataBinding(this, property_name);

		}

		return this._data_bindings_by_property[property_name];

	}
40057
public void templateModem_name_PUT(String name, OvhTemplateModem body) throws IOException {
		String qPath = "/xdsl/templateModem/{name}";
		StringBuilder sb = path(qPath, name);
		exec(qPath, "PUT", sb.toString(), body);
	}