当您使用第一个参数///////////////////////////////////////
// Required
///////////////////////////////////////
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
minifyCss = require('gulp-minify-css'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
plumber = require('gulp-plumber'),
browserSync = require('browser-sync').create(),
sourcemaps = require('gulp-sourcemaps'),
sass = require('gulp-sass');
///////////////////////////////////////
// Required
///////////////////////////////////////
gulp.task('userJs', function () {
return gulp.src('src/js/*.js')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('app.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/js'))
.pipe(browserSync.stream());
});
gulp.task('libJs', function () {
return gulp.src('src/js/libs/*.js')
.pipe(gulp.dest('dist/js/libs'))
.pipe(browserSync.stream());
});
gulp.task('sass', function () {
return gulp.src('src/scss/*.scss')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(sass())
.pipe(minifyCss())
.pipe(concat('app.css'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('dist/css'))
.pipe(browserSync.stream());
});
gulp.task('fonts', function () {
return gulp.src('fonts/*')
.pipe(gulp.dest('dist/fonts'))
.pipe(browserSync.stream());
});
gulp.task('images', function () {
return gulp.src('src/images/*')
.pipe(gulp.dest('dist/images'))
.pipe(browserSync.stream());
});
gulp.task('html', function () {
return gulp.src('src/index.html')
.pipe(gulp.dest('dist'))
.pipe(browserSync.stream());
});
gulp.task('browser-sync', function() {
browserSync.init({
server: {
baseDir: "dist" // This was the problem
}
});
});
///////////////////////////////////////
// Watch Task
///////////////////////////////////////
gulp.task('watch', function() {
gulp.watch('src/js/*.js', ['userJs']);
gulp.watch('src/js/libs/*.js', ['libJs']);
gulp.watch('src/scss/*.scss', ['sass']);
gulp.watch('src/images/*', ['images']);
gulp.watch('src/fonts/*', ['fonts']);
gulp.watch('src/index.html', ['html']);
});
///////////////////////////////////////
// Default Task
///////////////////////////////////////
gulp.task('default', ['libJs', 'userJs', 'sass', 'images', 'fonts', 'html', 'browser-sync', 'watch']);
而不是method_missing
来呼叫'string'
时,您会收到以下隐藏的错误消息:
:symbol
当您查看source code for method_missing
时BasicObject.send(:method_missing, 'any-method')
ArgumentError: no id given
from (pry):3:in `method_missing'
没有错误消息static VALUE
rb_method_missing(int argc, const VALUE *argv, VALUE obj)
{
rb_thread_t *th = GET_THREAD();
raise_method_missing(th, argc, argv, obj, th->method_missing_reason);
UNREACHABLE;
}
。
它来自哪里?
答案 0 :(得分:2)
raise_method_missing()
确实引发了这个参数错误:
static void
raise_method_missing(rb_thread_t *th, int argc, const VALUE *argv, VALUE obj,
int last_call_status)
{
// ...
if (argc == 0 || !SYMBOL_P(argv[0])) {
rb_raise(rb_eArgError, "no id given");
}
// ...
}