Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
Sheriffs:
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • salvin francis
  • fred rosenberger
  • Frits Walraven

What is the meaning of "class <<"?

 
Ranch Hand
Posts: 468
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In a discussion of Solitaire Cipher I found the code

The code appears to use @keystream as as an object of those methods, but I have not seen this any where.
 
Alejandro Barrero
Ranch Hand
Posts: 468
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found that an anonymous (singleton) class is associated with the specific object, so it is possible to add several methods.
 
Greenhorn
Posts: 3
Mac OS X Ruby Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Alejandro Barrero wrote:I found that an anonymous (singleton) class is associated with the specific object, so it is possible to add several methods.



See this discussion:

http://openmymind.net/2010/6/25/Learning-Ruby-class-self/

I prefer creating Singleton classes using the "extend self" idiom.

Both options are described here: https://blog.engineyard.com/2015/instances-classes-and-modules
 
Anderson gave himself the promotion. So I gave myself this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic