Class: Kokkai::Record
- Inherits:
-
Object
- Object
- Kokkai::Record
- Extended by:
- Memoist
- Defined in:
- lib/kokkai/record.rb
Constant Summary collapse
- DEFAULT_ATTRIBUTES =
i(session name_of_house name_of_meeting issue date meeting_url pdf_url).freeze
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#raw_record ⇒ Object
readonly
Returns the value of attribute raw_record.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(raw) ⇒ Record
constructor
A new instance of Record.
Constructor Details
#initialize(raw) ⇒ Record
Returns a new instance of Record.
32 33 34 35 |
# File 'lib/kokkai/record.rb', line 32 def initialize(raw) @raw = raw @raw_record = @raw.dig("recordData") end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
8 9 10 |
# File 'lib/kokkai/record.rb', line 8 def raw @raw end |
#raw_record ⇒ Object (readonly)
Returns the value of attribute raw_record.
8 9 10 |
# File 'lib/kokkai/record.rb', line 8 def raw_record @raw_record end |
Class Method Details
.define_attribute_methods(attrs) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/kokkai/record.rb', line 13 def define_attribute_methods(attrs) attrs.each do |attr| define_method(attr) do key = attr.to_s key = if key.match(/_url$/) key = key.split(/_url$/) { |s| s }.join() + "" key << "URL" else key.to_camel end @raw_record ? @raw_record[key] : nil end memoize attr end end |