Class: Result

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(author, work, section) ⇒ Result

Returns a new instance of Result.



102
103
104
105
106
# File 'lib/cite_mapper.rb', line 102

def initialize(author, work, section)
  @author_obj = author
  @work_obj = work
  @section = section
end

Instance Attribute Details

#sectionObject (readonly)

Returns the value of attribute section.



100
101
102
# File 'lib/cite_mapper.rb', line 100

def section
  @section
end

Instance Method Details

#authorObject



108
109
110
# File 'lib/cite_mapper.rb', line 108

def author
  @author_obj.name
end

#to_jsonObject



116
117
118
119
# File 'lib/cite_mapper.rb', line 116

def to_json
  content = %i{ author work section }.map { |category| to_property(category) }
  %{{ #{content.join(', ')} }}
end

#workObject



112
113
114
# File 'lib/cite_mapper.rb', line 112

def work
  @work_obj.name
end