Module: Unchained::Client::Mixins::Resource

Included in:
Archetypes::Archetype, Factions::Faction, Patcher::Alert, Patcher::HeroContent, Races::Race, Servers::Server
Defined in:
lib/unchained/client/mixins/resource.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



5
6
7
# File 'lib/unchained/client/mixins/resource.rb', line 5

def self.included(base)
  base.extend ClassMethods
end

Instance Method Details

#class_nameObject

Lurk, is there not a better way to do this?



15
16
17
# File 'lib/unchained/client/mixins/resource.rb', line 15

def class_name
  self.class.name.split('::').last
end

#to_sObject



9
10
11
12
# File 'lib/unchained/client/mixins/resource.rb', line 9

def to_s
  attributes = self.class::JSON_MAP.map{|k,_| "#{k}=#{self.send(k)}"}.join(" ")
  "[#{self.class_name}] #{attributes}"
end