Module: AyeCommander::Ivar::ClassMethods

Included in:
Command::ClassMethods, Resultable::Result::ClassMethods
Defined in:
lib/aye_commander/ivar.rb

Overview

Instance variable related class methods

Instance Method Summary collapse

Instance Method Details

#atObject


29
30
31
# File 'lib/aye_commander/ivar.rb', line 29

def at
  ::AyeCommander::Ivar::AT
end

#define_missing_reader(reader) ⇒ Object

Adds the received reader to the class. It prefers using 'uses' it available (command), but will use attr_reader if it isn't (result).


13
14
15
# File 'lib/aye_commander/ivar.rb', line 13

def define_missing_reader(reader)
  respond_to?(:uses) ? uses(reader) : attr_reader(reader)
end

#eqObject


33
34
35
# File 'lib/aye_commander/ivar.rb', line 33

def eq
  ::AyeCommander::Ivar::EQ
end

#to_ivar(name) ⇒ Object

Transforms the received name to instance variable form Eg: command -> @command


19
20
21
# File 'lib/aye_commander/ivar.rb', line 19

def to_ivar(name)
  name[0] == at ? name.to_sym : "@#{name}".to_sym
end

#to_nvar(name) ⇒ Object

Transforms the received name to normal variable form Eg: @command -> command


25
26
27
# File 'lib/aye_commander/ivar.rb', line 25

def to_nvar(name)
  name[0] == at ? name[1..-1].to_sym : name.to_sym
end