Class: Almanack::Representation::JSONFeed

Inherits:
Object
  • Object
show all
Defined in:
lib/almanack/representation/json_feed.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(calendar) ⇒ JSONFeed

Returns a new instance of JSONFeed.



6
7
8
# File 'lib/almanack/representation/json_feed.rb', line 6

def initialize(calendar)
  @calendar = calendar
end

Instance Attribute Details

#calendarObject (readonly)

Returns the value of attribute calendar.



4
5
6
# File 'lib/almanack/representation/json_feed.rb', line 4

def calendar
  @calendar
end

Class Method Details

.from(calendar) ⇒ Object



16
17
18
# File 'lib/almanack/representation/json_feed.rb', line 16

def self.from(calendar)
  self.new(calendar)
end

Instance Method Details

#to_sObject



10
11
12
13
14
# File 'lib/almanack/representation/json_feed.rb', line 10

def to_s
  json_friendly = SerializedTransformation.new(serialized)
  json_friendly.key { |key| camelize(key.to_s) }
  json_friendly.apply.to_json
end