Class: MisarBlog::Models::Base
- Inherits:
-
Object
- Object
- MisarBlog::Models::Base
- Defined in:
- lib/misarblog/models.rb
Overview
Base class: stores the raw Hash and offers indifferent-ish access.
Direct Known Subclasses
AiText, Analytics, Article, ArticleList, ArticleReactions, ImageResult, Plan, PlanUsage, Profile, ReactionResult, Series, SeriesList, TitleSuggestion, TitlesResult, TrialStatus
Instance Attribute Summary collapse
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #[](key) ⇒ Object
-
#initialize(raw) ⇒ Base
constructor
A new instance of Base.
- #to_h ⇒ Object
Constructor Details
#initialize(raw) ⇒ Base
Returns a new instance of Base.
10 11 12 |
# File 'lib/misarblog/models.rb', line 10 def initialize(raw) @raw = raw || {} end |
Instance Attribute Details
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
8 9 10 |
# File 'lib/misarblog/models.rb', line 8 def raw @raw end |
Instance Method Details
#[](key) ⇒ Object
14 15 16 |
# File 'lib/misarblog/models.rb', line 14 def [](key) @raw[key.to_s] end |
#to_h ⇒ Object
18 19 20 |
# File 'lib/misarblog/models.rb', line 18 def to_h @raw end |