Eval 1 Syntax Error Unexpected $end
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more parse error syntax error unexpected end of file about Stack Overflow the company Business Learn more about hiring developers or posting ads syntax error unexpected end of file php with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
Syntax Error Unexpected End Of File Bash
is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up syntax error, unexpected ':', expecting end-of-input up vote 1 down vote favorite
Syntax Error Unexpected End Of File Wordpress
I am getting the following error: syntax error, unexpected ':', expecting end-of-input field :'lastapple info', type: String ^ with this method right here: def eval_mongo(klass, field) _field = field['field'].to_sym _type = FieldType.where(_id: field['field_type_id']).first.type_from_field klass.class_eval <<-EOS field :'#{ _field }', type: #{ _type } EOS end I stare at this and I cannot figure out where the error is. Since I am using heredocs, I do not require a do syntax error unexpected end of file bash script end for class_eval. In fact, it works fine in the console and I used it before so I know this cannot be the issue. So then what is the issue? ruby mongoid share|improve this question edited Nov 29 '14 at 1:33 mu is too short 285k42553558 asked Nov 28 '14 at 20:48 Donato 1,0471924 Shouldn't that be field :#{ _field}, type: #{ _type }? You want to build a symbol, not a string, right? –marc Nov 28 '14 at 20:51 @marc I need the string because last_apple info without a string will produce an invalid method with a space and cause an undefined info error. –Donato Nov 28 '14 at 20:51 That should work. What Ruby version are you using? Using eval is always highly worrying, so I'd hope you can avoid this by using klass.send(_field.to_sym, _type) –tadman Nov 28 '14 at 20:55 @tadman ruby '2.1.2' and I know it should work, I used it elsewhere and it works fine. Just in this specific method it does not work. –Donato Nov 28 '14 at 20:56 It is very hard to see any error here. I'd recommend eliminating syntax sugar (use self., method parens, curly braces a
unexpected end-of-input, expecting keyword_end In the Ruby foundation example video one of the examples involves building a speech class , but everytime I run the program i get the following error - "syntax
Syntax Error Unexpected End Of File Shell Script
error, unexpected end-of-input, expecting keyword_end" here's my speech-example.rb code. class Speech def initialize print syntax error unexpected end of file python "What is the speech name? " @title = gets.chomp @lines = [] while add_line puts "Line added." end end def title @title syntax error unexpected end of file unix end def add_line puts "Add a line: (blank line to exit)" line = gets.chomp if line.length > 0 @lines.push line return line else return nil end def each(&block) @lines.each { |line| yield line} end end http://stackoverflow.com/questions/27195710/syntax-error-unexpected-expecting-end-of-input speech = Speech.new speec.each do |line| puts "[#{speech.title}] @{line}" end Oh, I'm also running the following version of Ruby - ruby 2.1.2p95 Thanks guys 2 Answers MOD Michael Hulet Treehouse Moderator 34,790 Points Michael Hulet Michael Hulet Treehouse Moderator 34,790 Points over 2 years ago You're missing and end to close out your add_line method. This code works: class Speech def initialize print "What is the speech name? " @title https://teamtreehouse.com/community/syntax-error-unexpected-endofinput-expecting-keywordend = gets.chomp @lines = [] while add_line puts "Line added." end end def title @title end def add_line puts "Add a line: (blank line to exit)" line = gets.chomp if line.length > 0 @lines.push line return line else return nil end #You were missing the end statement right here end def each(&block) @lines.each { |line| yield line} end end speech = Speech.new speec.each do |line| puts "[#{speech.title}] @{line}" end PRO Hoormazd Kia Pro Student 6,075 Points Hoormazd Kia Hoormazd Kia Pro Student 6,075 Points over 2 years ago Thanks. guess I was just tired :) Posting to the forum is only allowed for members with active accounts. Please sign in or sign up to post. Our mission is to bring affordable, technology education to people everywhere, in order to help them achieve their dreams and change the world. Our Company About Us Contact Us Community Treehouse Stories Student Perks Treehouse Blog Affiliate Program Careers Topics HTML CSS Design JavaScript Ruby PHP WordPress iOS Android Development Tools Business Tracks Web Design Web Development Rails Development PHP Development iOS Development Android Development WordPress Development Starting a Business Treehouse Blog About Treehouse Privacy Policy Terms & Conditions © 2016 Treehouse Island, Inc. Sign in Email Address Password I forgot my password Sign in
years ago by Hoormazd Kia Hoormazd Kia Pro Student 6,075 Points syntax http://askubuntu.com/questions/739695/bash-etc-bash-bashrc-line-122-syntax-error-unexpected-end-of-file error, unexpected end-of-input, expecting keyword_end (SyntaxError) Hello, My problem begins about 5 minutes into the tutorial video, syntax error where we are asked to run the following command in our CLI "bin/rspec spec/features/todo_lists/edit_spec.rb " We are supposed to expect a failure, but I receive a "expecting keyword_end" syntax error as mentioned above, but the syntax error unexpected error isn't coming from the edit_spec.rb file, it's coming from all over the place, here's the full text... ** Myname-MacBook-Pro:odot username$ bin/rspec spec/features/todo_lists/edit_spec.rb /Users/username/treehouse/projects/odot/config/environment.rb:2:in require': /Users/username/treehouse/projects/odot/config/application.rb:28: syntax error, unexpected end-of-input, expecting keyword_end (SyntaxError) from /Users/username/treehouse/projects/odot/config/environment.rb:2:in
communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads with us Ask Ubuntu Questions Tags Users Badges Unanswered Ask Question _ Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute: Sign up Here's how it works: Anybody can ask a question Anybody can answer The best answers are voted up and rise to the top bash: /etc/bash.bashrc: line 122: syntax error: unexpected end of file up vote 0 down vote favorite # System-wide .bashrc file for interactive bash(1) shells. # To enable the settings / commands in this file for login shells as well, # this file has to be sourced in /etc/profile. # If not running interactively, don't do anything if [ -z "$PS1" ] && return # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, overwrite the one in /etc/profile) PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' use_color=true # Set colorful PS1 only on colorful terminals. # dircolors --print-database uses its own built-in database # instead of using /etc/DIR_COLORS. Try to use the external file # first to take advantage of user additions. Use internal bash # globbing instead of external grep binary. safe_term=${TERM//[^[:alnum:]]/?} # sanitize TERM match_lhs="" [[ -f ~/.dir_colors ]] && match_lhs="${match_lhs}$(<~/.dir_colors)" [[ -f /etc/DIR_COLORS ]] && match_lhs="${match_lhs}$(/dev/null \ && match_lhs=$(dircolors --print-database) [[ $'\n'${match_lhs} == *$'\n'"TERM "${safe_term}* ]] && use_color=true if ${use_color} ; then # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then # t