Questions tagged [method-missing]

The Ruby method that is invoked on an object when you send it a message (or call a method) that it doesn't understand.

The method_missing method is used to respond to methods when you don't know what methods you need to understand until runtime.

124 questions
0
votes
1 answer

Method missing in tutorial

I'm new in the iOS programming, so I've followed one of Apple's Developer library-tutorials. In the "Implementing an app - Tutorial: Add data" part, the site wants me to change the tableView:cellForRowAtIndexPath method. The thing is, there is no…
0
votes
1 answer

Rails shared constants using method_missing in a DRY fashion

I have a written a class: module SharedConstants class Stage CONST = { created: 0, prepared: 1, shadowed: 2, vmxed: 3, sbooted: 4, booted: 5, saved: 6, dontknowen: 7 …
Midwire
  • 1,090
  • 8
  • 25
0
votes
0 answers

Equivalent to Rubys method_missing at global scales

I was doing a bit of metaprogramming lately and found it to be much easier in Ruby, mainly because the main context in Ruby is an object and I can override its method_missing. Now, there are several constructs in Python that emulate that behaviour…
hellerve
  • 508
  • 1
  • 6
  • 30
0
votes
1 answer

Could not find System.Threading after deploying in mscorlib.dll in Microsoft Compact Framework 2.0/3.5

i am facing a problem in windows mobile 6. i have developed an app and i have used Timer class that is present in System.Threading namespace present in mscorlib.dll assembly. the problem is that when i debug it or when i deploy it by creating proper…
0
votes
1 answer

Slick2D Methods are missing

I am using Slick2D to code a little game, and after a lot of time that already went into it, I changed my mind and decided that I indeed want the game to be resizable. So I tried to use the app.setResizable() command, as suggested on the Slick2D…
flotothemoon
  • 1,882
  • 2
  • 20
  • 37
0
votes
3 answers

Ruby nested const_missing method_missing stack too deep

I have the following class: module APIWrapper include HTTParty BASE_URI = 'https://example.com/Api' def self.const_missing(const_name) anon_class = Class.new do def self.method_missing method_name, *params params = { …
kid_drew
  • 3,857
  • 6
  • 28
  • 38
0
votes
1 answer

AngularJS function undefined when uncommenting it

I have some weird problems related with defintion of method inside scope. Once it's defined, and when I want to call it (just by entering it into code) it disappears. I have this part of code if (ConfigurationService.isConfigurationChanged() ===…
Slaven Tomac
  • 1,552
  • 2
  • 26
  • 38
0
votes
2 answers

Metaprogramming in ActionMailer::Base

I am actually creating a newsletter massmailling software from which I can create a new mailling list on the fly, upload a template, and then send an email to the suscribers from that list doing something like this: @suscribers.each do |suscriber| …
0
votes
4 answers

method_missing with unquoted string arguments in Ruby - possible?

I'm learning Ruby and want to be able to do this: Printer.hi there and have Ruby output "hi there" So far I have the following implementation class Printer def method_missing(name, *args) puts "#{name} #{args.join(',')}" end end But…
Nabeelah Ali
  • 529
  • 4
  • 9
0
votes
1 answer

Alternatives for list methods for IE?

I am looking for a way to do node.classList.contains("foo") in Internet Exploder 7-9 without needing to refactor major portions of my code. This method is present in all other browsers (even IE10). I have found Code with classList does not work in…
Cobra_Fast
  • 15,671
  • 8
  • 57
  • 102
0
votes
1 answer

`method_missing': undefined method `user_class=' for #

When i run rails server,i encountered this error. 'bundle install' has been success.My RVM use ruby 1.9.3 and rails 3.2 but the project need rails 3.1.I think the bundle has already solved the because of the bundle.The rails and ruby might not be…
magic_cwin
  • 13
  • 1
  • 4
0
votes
2 answers

Undefined method even after method_missing handling

I'm studying Ruby and try to implement method_missing, but it's not working. For example, I want to print method name after find_ but ruby raises "undefined method 'find_hello'" when i call it on Book instance. TEST_05.RB module Searchable def…
Pavel Tkackenko
  • 963
  • 7
  • 20
0
votes
1 answer

Methods are not available from the class

I have a project that I need to determine the Time Zone for. The TimeZone class seems perfect for the task: import java.util.TimeZone; long tzo = TimeZone.getRawOffset(); However, The getRawOffset method is not available. What am I not…
Roy Hinkley
  • 10,111
  • 21
  • 80
  • 120
0
votes
1 answer

question regarding define_method and method_missing

How can I make this code work? class Meta @array = [:a,:b] def self.method_missing(name, *args, &block) if @array.include? name self.class.send(:define_method, name) do …
Bruno Antunes
  • 2,241
  • 4
  • 21
  • 35
0
votes
1 answer

Best way to access session from method_missing in model

I know that model should not be aware of session data but I have a need to access a small bit of state information in the method_missing that is defined on a model. Methods caught by method_missing are invoked by form helpers,…
1 2 3
8
9