Class: Fortnox::Relation

Inherits:
Object
  • Object
show all
Defined in:
lib/fortnox/relation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, type, class_override: nil) ⇒ Relation

Returns a new instance of Relation.



5
6
7
8
9
# File 'lib/fortnox/relation.rb', line 5

def initialize(name, type, class_override: nil)
  @name = name.to_s
  @type = type
  @class_override = class_override
end

Instance Attribute Details

#class_overrideObject (readonly)

Returns the value of attribute class_override.



3
4
5
# File 'lib/fortnox/relation.rb', line 3

def class_override
  @class_override
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/fortnox/relation.rb', line 3

def name
  @name
end

#typeObject (readonly)

Returns the value of attribute type.



3
4
5
# File 'lib/fortnox/relation.rb', line 3

def type
  @type
end

Instance Method Details

#relation_classObject



11
12
13
# File 'lib/fortnox/relation.rb', line 11

def relation_class
  "Fortnox::#{class_override || name.classify}".constantize
end