Class: DfeTaxweb::Atributo

Inherits:
Object
  • Object
show all
Defined in:
lib/dfe_taxweb/atributo.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(atributos, caminho = '') ⇒ Atributo

Returns a new instance of Atributo.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/dfe_taxweb/atributo.rb', line 6

def initialize(atributos, caminho='')
  @caminho = caminho
  pai_titulo = caminho =~ /\./ ? DfeTaxweb.atributo(caminho[0, caminho.rindex('.')]).titulo : ''
  atributos.each do |k, v|
    begin
      if k.to_s=='titulo'
        self.titulo = "#{pai_titulo} #{v}"
      else
        self.send(:"#{k}=", v)
      end
    rescue NoMethodError => e
      # self.class.send(:attr_accessor, k)
      # retry
    end
  end
end

Instance Attribute Details

#caminhoObject (readonly)

Returns the value of attribute caminho.



4
5
6
# File 'lib/dfe_taxweb/atributo.rb', line 4

def caminho
  @caminho
end

#descricaoObject

Returns the value of attribute descricao.



3
4
5
# File 'lib/dfe_taxweb/atributo.rb', line 3

def descricao
  @descricao
end

#tituloObject

Returns the value of attribute titulo.



3
4
5
# File 'lib/dfe_taxweb/atributo.rb', line 3

def titulo
  @titulo
end