Questions tagged [method-names]

55 questions
1
vote
2 answers

Get the method name

The following code works: class String def color(code) "\e[#{code}m#{self}\e[0m" end end puts "Anything".color(93) I want to be able to do: puts "Anything".red by catching the red as a string, and then giving it to a case-block as…
yokmp
  • 145
  • 2
  • 10
1
vote
2 answers

Use @ symbol in a rails method name

Is there any way for me to use the '@' symbol in a rails method name? e.g. def @method_name end Rails doesn't seem to like it. I want to do it to adhere to some external conventions (external to rails).
user3711600
  • 853
  • 3
  • 12
  • 27
1
vote
1 answer

get method as text

I need to save and load some properties to a database and I am stuck with this. I have a form with several methods and a button. button.onclick event is assigned to one of the form's methods. I need to get the name of the assigned method as string…
Kiril Hadjiev
  • 302
  • 2
  • 13
1
vote
0 answers

How to understand the symbolic method name in JVM?

I tried to dump the methods' symbolic names. e.g. .hasLines()Z The strange thing is that I also got some similar names.…
JackWM
  • 10,085
  • 22
  • 65
  • 92
1
vote
0 answers

Rename abstract test methods (Visual Studio / c#)

Question: Is there a way to manually name a test method instead of taking the methodname? Background: I'm currently active as a BizTalk developer and we use the BizUnit framework to test our projects. To get these unit tests running we use the…
0
votes
0 answers

How to add methodname in logging using runtime reconfiguration

I'm working on a C# application, using NLog for logging purposes. I have just seen the following in a logfile: 2023-06-08 11:15:58.1816 | NameSpace.ClassName | CheckMATCO | Check CheckFixstation ... This is caused by the following piece of source…
Dominique
  • 16,450
  • 15
  • 56
  • 112
0
votes
1 answer

Issue with method name, Spring Boot

I am working on a booking application for learning purposes, a problem with a method name in the repository interface Optional findByIdAndStatus(int id, status status); and I am always getting this error: Error starting…
0
votes
1 answer

Naming conventions. Method or variable names containing numbers as a words

I can't find even couple of words about containing numbers in names of variables or on methods. Does anyone have any authoritative information about such cases: string2map its4me etc... Exactly using number as a word but not number as a number. Is…
0
votes
1 answer

How to get the method name and line number in Exception in ASP Core 5

I want to get the method name and line number when an error occur, I am using Core 5. try { //My code } catch (Exception ex) { _logger.LogError(ex, "Method Name / Line Number"); …
fiverbox.com
  • 119
  • 9
0
votes
3 answers

How to name method that can only return one entry. (C#, ASP.NET)

I have a method, that returns a List of strings. For some reason I do not allow the method to return a List with more than one string in it. Is it better to name such a method GetEntry or GetEntries?
AGuyCalledGerald
  • 7,882
  • 17
  • 73
  • 120
0
votes
1 answer

how to use use class method name inside method itself?

Is there better way to get function name inside the class. I would like to get and "A.boo" without using self.boo statement. this is the test.py which I ran import sys import traceback def foo(): print(foo.__name__) …
rho
  • 771
  • 9
  • 24
0
votes
2 answers

Method naming: including or excluding the parameter type with multiple similar methods

When faced with a class that has multiple similar methods operating on different parameter types, do you include some kind of description of the parameters in the method name, or do you keep the name the same and trust that the parameters themselves…
Zecrates
  • 2,952
  • 6
  • 33
  • 50
0
votes
0 answers

Anybody know why mono SQLite uses SqliteConnection but Windows uses SQLiteConnection?

I am adapting a large open-source Windows program to Linux, using MonoDevelop. I find that the SQLite method names in Windows look like this: SQLiteConnection but in Mono.Data.Sqlite they look like this: SqliteConnection with different case,…
JimH44
  • 504
  • 5
  • 13
0
votes
1 answer

Scala method name length convention

I'm looking into code smells that have an impact on the readability of an application. I came across long method names and I was wondering if there is a convention for this. I've checked the naming conventions in the scaladocs but it didn't list…
RemcoW
  • 4,196
  • 1
  • 22
  • 37
0
votes
2 answers

Ruby: what is the best way to find out method type in method_missing?

At the moment I've got this code: name, type = meth.to_s.match(/^(.+?)([=?]?)$/)[1..-1] But it doesn't seem to be the best solution =\ Any ideas how to make it better? Thanks.
Daniel
  • 4,272
  • 8
  • 35
  • 48