词汇:name
n. 名称,名字;姓名;名誉
相关场景
SMEAGOL V/0 (cont'd) And we wept, Precious, we wept to be so alone. And we forgot the taste of bread, the sound of trees, the softness of the wind . . . We even forgot our own name.
>> 指环王3:王者归来The Lord of the Rings: The Return of the King Movie Script
>> 指环王3:王者归来The Lord of the Rings: The Return of the King Movie Script
I have told your names to the Ent moot and we have agreed – you are not Orcs.
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
Give me your sword. What is your name?
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
We are hobbits of the Shire. Frodo Baggins is my name and this is Samwise Gamgee.
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
Call him names; run him down all the time.
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
Lathspell spell I name him. Ill news is an ill guest.
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
Gandalf? Yes... That's what they used to call me. Gandalf the Grey. That was my name. [He smiles]
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
My name... My name... S... S...Sméagol… [Suddenly, the piercing cries of the Nazgûl are heard overhead]
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
[Turns to face the hobbits.] The Dead Marshes. Yes, yes that is their name.
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
Give me your name, Horsemaster, and I shall give you mine.
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
>> 指环王2:双塔奇兵The Lord of the Rings: The Two Towers Movie Script
He's one of them Rangers; they're dangerous folk they are, wandering the wilds. What his right name is, I never heard, but round here he's known as Strider.
>> 指环王1:护戒使者 The Lord of the Rings: The Fellowship of the Ring Movie Script
>> 指环王1:护戒使者 The Lord of the Rings: The Fellowship of the Ring Movie Script
Underhill...my name's Underbill.
>> 指环王1:护戒使者 The Lord of the Rings: The Fellowship of the Ring Movie Script
>> 指环王1:护戒使者 The Lord of the Rings: The Fellowship of the Ring Movie Script
You'll have to leave the name of Baggins behind you...for that name is not safe outside the Shire. GANDALF helps FRODO into his coat.
>> 指环王1:护戒使者 The Lord of the Rings: The Fellowship of the Ring Movie Script
>> 指环王1:护戒使者 The Lord of the Rings: The Fellowship of the Ring Movie Script
An ancient PARCHMENT MAP of MIDDLE EARTH...moving slowly across the MAP as if drawn by an unseen force the CAMERA closes in on a PLACE NAME...MORDOR.
>> 指环王1:护戒使者 The Lord of the Rings: The Fellowship of the Ring Movie Script
>> 指环王1:护戒使者 The Lord of the Rings: The Fellowship of the Ring Movie Script
你能说出一些常见的补品吗?
尽可能的自动化测试;运行代码才知道代码在干啥;测试又happy path and exception path; fuzz testing and property testing; require('fuzzbert') require('uri') fuzz('URI::HTTP:build') do data("random server names") do FuzzBert::Generators.random end deploy do |data| URI::HTTP.build(host: data, path: '/') end 会持续运行,手动停止。 MrProper; properties("Version") do data([Integer, Integer, Integer]); property("new(str).to_s == str") do |data| str= data.join('.'); assert_equal(str, Version.new(str).to_s); 测试驱动开发里面的测试并不好写,
>> Effective Ruby
>> Effective Ruby
def glass_case_of_emotion x="I'm in a " + __method__.to_s.tr('_',' ') binding; binding 可以获得当前的临时域并把这个临时域封装到Binding对象中作为返回结果。这个指定的上下文是eval方法的第二个参数; eval("x", glass_case_of_emotion); class_eval很像是重新打开类,实际上是被定义在Module里面,only被模块和类使用。= moudle_eval; instance_eval访问实例变量;class_eval定义实例方法。 class Widget attr_accessor(:name, :quantity) def initialize(&block) instance_eval(&block) if block end ;;; w= Widget.new do |widget| widget.name= "Elbow Grease" ; @quantity = 0; end ; instance_exec, class_exec, moudle_exec; only accept 代码块, no string; object.instance_eval("@#{name} = DEFAULT")
module Reset def self.reset_var (object, name) object.instance_exec("@#{name}.to_sym") do |var| const = self.class.const_get(:DEFAULT); instance_variable_set(var, const) end ...
>> Effective Ruby
module Reset def self.reset_var (object, name) object.instance_exec("@#{name}.to_sym") do |var| const = self.class.const_get(:DEFAULT); instance_variable_set(var, const) end ...
>> Effective Ruby
如果没有找到任何方法,method_missing就会被执行;但是因为又super的原因,这里会有迷惑。def method_missing(name, *args, &block) if @hash.respond_to?(name) @hash.send(name, *args, &block) else super end end; Hash.public_instance_methods(false).each do |name| define_method(name) do |*args, &block| @hash.send(name, *args, &block) end; h.public_methods(false).sort.take(5); 实现了Hash的方法。
AuditDecorator @logger = Logger.new($stdout); private def method_messing(name, *arg, &block) @logger.info("calling '#{name}' on #{@object.inspect}"); @object.send(name, *args, &block); define_method更加适合做这个了。 mod=Module.new do object.public_methods.each do |name| define_method(name) do |*args, &block| @logger.info("") @object.send(name, *args, &block) end end end extend(mod) ; 创建了一个匿名的模块。 —— define_method恢复了内省方法。。 respond_to? and respond_to_missing?
>> Effective Ruby
AuditDecorator @logger = Logger.new($stdout); private def method_messing(name, *arg, &block) @logger.info("calling '#{name}' on #{@object.inspect}"); @object.send(name, *args, &block); define_method更加适合做这个了。 mod=Module.new do object.public_methods.each do |name| define_method(name) do |*args, &block| @logger.info("") @object.send(name, *args, &block) end end end extend(mod) ; 创建了一个匿名的模块。 —— define_method恢复了内省方法。。 respond_to? and respond_to_missing?
>> Effective Ruby
Enumerable模块的类,可对集合进行过滤,遍历和转化。map和select;还有个可以管理一切的方法 reduce(or inject), reduce可以转换结构;接受者,每个元素被调用一次,并产生返回值,累加器。 enum.reduce(0){|accumulator, element| accumulator + element} 0初始值;建议你总是使用一个带有起始值的累加器。 enum.reduce(0, :+);
数组转成Hash; array.reduce({}) {|hash, element| hash.update(element => true)}
users.select{|u| u.age>=21}.map(&:name) 获取大于等于21的names数组。比较低效;
User.reduce([]) {|names, user| names << user.name if user.age >=21 ; names}
>> Effective Ruby
数组转成Hash; array.reduce({}) {|hash, element| hash.update(element => true)}
users.select{|u| u.age>=21}.map(&:name) 获取大于等于21的names数组。比较低效;
User.reduce([]) {|names, user| names << user.name if user.age >=21 ; names}
>> Effective Ruby
def initialize(name,grade) {super(name; @grade = grade}; dup和clone 也可以构建新对象的副本,可以定义initialize_copy方法来初始化副本。
>> Effective Ruby
>> Effective Ruby
My name is Lily. I'm from China International Travel Agency. Our company has assigned me to be your host here in Wuhan.
>> 1. Meeting the Guests at the Airport
>> 1. Meeting the Guests at the Airport
我叫莉莉。我来自中国国际旅行社。我们公司派我来武汉做你的东道主。
We'll turn those on and I'll show you the manifest first. The manifest is just really basic. It's gonna show the name of the PWA you're gonna using!
>> Rails 8.0.1 You are in good company
>> Rails 8.0.1 You are in good company